Permalink
Browse files

added offset support to build script

  • Loading branch information...
1 parent 8ba1b3d commit 6e5e35e8d2fb518047c8dcce20ec02bdd0a93afb @dryan committed Oct 19, 2011
Showing with 64 additions and 3 deletions.
  1. +64 −3 build-css.py
View
@@ -272,6 +272,46 @@ def get_number_word(num):
breakpoint_output.append('\t\tfloat: left;')
breakpoint_output.append('\t\tmargin-left: 20px;')
breakpoint_output.append('\t}')
+ if col < opts.columns:
+ # do the offset
+ # handle the special case names
+ if opts.columns / 2.0 == float(col):
+ if breakpoint_suffixes[i]:
+ for x in range(i, len(breakpoint_suffixes)):
+ if not breakpoint_suffixes[x] == breakpoint_suffix.strip('.'):
+ breakpoint_output.append('\t.%s.%s .offset-one-half,' % (container_class, breakpoint_suffixes[x]))
+ breakpoint_output.append('\t.%s%s .offset-one-half,' % (container_class, breakpoint_suffix))
+ if opts.columns / 4.0 == float(col):
+ if breakpoint_suffixes[i]:
+ for x in range(i, len(breakpoint_suffixes)):
+ if not breakpoint_suffixes[x] == breakpoint_suffix.strip('.'):
+ breakpoint_output.append('\t.%s.%s .offset-one-fourth,' % (container_class, breakpoint_suffixes[x]))
+ breakpoint_output.append('\t.%s%s .offset-one-fourth,' % (container_class, breakpoint_suffix))
+ if opts.columns / 3.0 == float(col):
+ if breakpoint_suffixes[i]:
+ for x in range(i, len(breakpoint_suffixes)):
+ if not breakpoint_suffixes[x] == breakpoint_suffix.strip('.'):
+ breakpoint_output.append('\t.%s.%s .offset-one-third,' % (container_class, breakpoint_suffixes[x]))
+ breakpoint_output.append('\t.%s%s .offset-one-third,' % (container_class, breakpoint_suffix))
+ if (opts.columns / 4.0) * 3 == float(col):
+ if breakpoint_suffixes[i]:
+ for x in range(i, len(breakpoint_suffixes)):
+ if not breakpoint_suffixes[x] == breakpoint_suffix.strip('.'):
+ breakpoint_output.append('\t.%s.%s .offset-three-fourths,' % (container_class, breakpoint_suffixes[x]))
+ breakpoint_output.append('\t.%s%s .offset-three-fourths,' % (container_class, breakpoint_suffix))
+ if (opts.columns / 3.0) * 2 == float(col):
+ if breakpoint_suffixes[i]:
+ for x in range(i, len(breakpoint_suffixes)):
+ if not breakpoint_suffixes[x] == breakpoint_suffix.strip('.'):
+ breakpoint_output.append('\t.%s.%s .offset-two-thirds,' % (container_class, breakpoint_suffixes[x]))
+ breakpoint_output.append('\t.%s%s .offset-two-thirds,' % (container_class, breakpoint_suffix))
+ if breakpoint_suffixes[i]:
+ for x in range(i, len(breakpoint_suffixes)):
+ if not breakpoint_suffixes[x] == breakpoint_suffix.strip('.'):
+ breakpoint_output.append('\t.%s.%s .offset-%s,' % (container_class, breakpoint_suffixes[x], get_number_word(col)))
+ breakpoint_output.append('\t.%s%s .offset-%s {' % (container_class, breakpoint_suffix, get_number_word(col)))
+ breakpoint_output.append('\t\tpadding-left: %dpx;' % (col_width + opts.gutter_width))
+ breakpoint_output.append('\t}')
if col == 1 and breakpoint == minimum_container_with_columns:
if breakpoint_suffixes[i]:
for x in range(i, len(breakpoint_suffixes)):
@@ -292,13 +332,27 @@ def get_number_word(num):
breakpoint_output.append('\t.%s%s .%s.one-fourth {' % (container_class, breakpoint_suffix, column_class))
breakpoint_output.append('\t\twidth: %dpx;' % one_fourth)
breakpoint_output.append('\t}')
+ if breakpoint_suffixes[i]:
+ for x in range(i, len(breakpoint_suffixes)):
+ if not breakpoint_suffixes[x] == breakpoint_suffix.strip('.'):
+ breakpoint_output.append('\t.%s.%s .offset-one-fourth,' % (container_class, breakpoint_suffixes[x]))
+ breakpoint_output.append('\t.%s%s .offset-one-fourth {' % (container_class, breakpoint_suffix))
+ breakpoint_output.append('\t\tpadding-left: %dpx;' % one_fourth + opts.gutter_width)
+ breakpoint_output.append('\t}')
if breakpoint_suffixes[i]:
for x in range(i, len(breakpoint_suffixes)):
if not breakpoint_suffixes[x] == breakpoint_suffix.strip('.'):
breakpoint_output.append('\t.%s.%s .%s.three-fourths,' % (container_class, breakpoint_suffixes[x], column_class))
breakpoint_output.append('\t.%s%s .%s.three-fourths {' % (container_class, breakpoint_suffix, column_class))
breakpoint_output.append('\t\twidth: %dpx;' % ((one_fourth * 3) + (opts.gutter_width * 2)))
breakpoint_output.append('\t}')
+ if breakpoint_suffixes[i]:
+ for x in range(i, len(breakpoint_suffixes)):
+ if not breakpoint_suffixes[x] == breakpoint_suffix.strip('.'):
+ breakpoint_output.append('\t.%s.%s .offset-three-fourths,' % (container_class, breakpoint_suffixes[x]))
+ breakpoint_output.append('\t.%s%s .offset-three-fourths {' % (container_class, breakpoint_suffix))
+ breakpoint_output.append('\t\tpadding-left: %dpx;' % ((one_fourth * 3) + (opts.gutter_width * 3)))
+ breakpoint_output.append('\t}')
if thirds < 2:
# we need to manually figure out the third column values
one_third = (container_width - (opts.gutter_width * 2)) / 3
@@ -312,9 +366,16 @@ def get_number_word(num):
if breakpoint_suffixes[i]:
for x in range(i, len(breakpoint_suffixes)):
if not breakpoint_suffixes[x] == breakpoint_suffix.strip('.'):
- breakpoint_output.append('\t.%s.%s .%s.two-thirds,' % (container_class, breakpoint_suffixes[x], column_class))
- breakpoint_output.append('\t.%s%s .%s.two-thirds {' % (container_class, breakpoint_suffix, column_class))
- breakpoint_output.append('\t\twidth: %dpx;' % (one_third * 2) + opts.gutter_width)
+ breakpoint_output.append('\t.%s.%s .offset-one-third,' % (container_class, breakpoint_suffixes[x]))
+ breakpoint_output.append('\t.%s%s .offset-one-third {' % (container_class, breakpoint_suffix))
+ breakpoint_output.append('\t\tpadding-left: %dpx;' % (one_third + opts.gutter_width))
+ breakpoint_output.append('\t}')
+ if breakpoint_suffixes[i]:
+ for x in range(i, len(breakpoint_suffixes)):
+ if not breakpoint_suffixes[x] == breakpoint_suffix.strip('.'):
+ breakpoint_output.append('\t.%s.%s .offset-two-thirds,' % (container_class, breakpoint_suffixes[x]))
+ breakpoint_output.append('\t.%s%s .offset-two-thirds {' % (container_class, breakpoint_suffix))
+ breakpoint_output.append('\t\tpadding-left: %dpx;' % (one_third * 2) + (opts.gutter_width * 2))
breakpoint_output.append('\t}')
if breakpoint == opts.ie_fallback_width:

0 comments on commit 6e5e35e

Please sign in to comment.