From 97835d382a39430a041f8bffae7e492c72b97392 Mon Sep 17 00:00:00 2001 From: Mark Pilgrim Date: Fri, 5 Jun 2009 00:58:26 -0400 Subject: [PATCH] build fiddling --- about.html | 2 +- mobile.css | 2 +- publish | 6 ++++++ util/flatten.py | 4 ---- util/lesscss.py | 17 +++++++++++++++++ 5 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 util/lesscss.py diff --git a/about.html b/about.html index aac9e64..80d53ea 100644 --- a/about.html +++ b/about.html @@ -20,7 +20,7 @@ h1:before{content:""}
  1. jQuery is served by Google AJAX Libraries API.
  2. Other Javascript and CSS resources are minimized by YUI Compressor. -
  3. HTTP caching and other server-side options are optimized based on advice from YSlow. +
  4. HTTP caching and other server-side options are optimized based on advice from YSlow and Page Speed.
  5. The text uses Unicode characters in place of graphics wherever possible.
  6. The entire book was lovingly hand-authored in HTML 5 to avoid markup cruft.
diff --git a/mobile.css b/mobile.css index 7277919..0e914a7 100644 --- a/mobile.css +++ b/mobile.css @@ -98,7 +98,7 @@ h1:before { /* overrides */ -.nm, .w, aside, form, form+p, .note span, .q span { +.nm, .w, aside, form, form+p, .note span, .q span, .a { display:none; } dd { diff --git a/publish b/publish index 64f2b91..fb0fdf4 100755 --- a/publish +++ b/publish @@ -49,6 +49,12 @@ echo "inlining CSS" css=`cat build/$revision.css` sed -i -e "s|||g" -e "s|', 1)[0] +new_css = '' +for rule in original_css.split('}')[:-1]: + selectors, properties = rule.split('{', 1) + selectors = ','.join([s for s in selectors.split(',') if pqd(s.split(':', 1)[0])]) + if selectors: + new_css += '%s{%s}' % (selectors, properties) +open(filename, 'wb').write(raw_data.replace(original_css, new_css))