From 4036713175dc9cbb8c39354773ee8221051a2f96 Mon Sep 17 00:00:00 2001 From: eric thul Date: Mon, 19 Mar 2012 23:13:07 -0400 Subject: [PATCH] Migration to the rake-pipeline Using the rake pipeline to generate the assets for the website, including the HTML templates. We have LESS generation, and hex digesting for the file names of images and CSS. Because the cache-buster filter in the rake pipeline alters the names of the resources, we need a way to determine the new names so that they can be included in the Slim templates. The workaround for this is to rub a Ruby statement to look-up the newest asset file and use that in the template. Not the prettiest, but does get at the correct file name. The gotcha is that the assets must be generated in the right order so that dependencies will exist when they are looked up by the file name. So if you had an HTML file including a CSS file, the CSS must be generated first in the Assetfile --- .gitignore | 4 +- .htaccess | 540 ------------------ .rspec | 2 - Assetfile | 45 ++ Gemfile | 8 +- Gemfile.lock | 54 +- .../eric.png} | Bin 404.html => assets/statics/404.html | 0 .../statics/crossdomain.xml | 0 humans.txt => assets/statics/humans.txt | 0 robots.txt => assets/statics/robots.txt | 0 .../_boilerplate.less} | 0 assets/stylesheets/_frame.less | 36 ++ assets/{ => stylesheets}/cv.less | 2 +- assets/{ => stylesheets}/index.less | 44 +- cv.slim => assets/templates/cv.slim | 0 index.slim => assets/templates/index.slim | 3 +- layout.slim => assets/templates/layout.slim | 2 +- lib/makers/css_maker.rb | 47 -- lib/makers/html_maker.rb | 41 -- script/.gitkeep | 0 script/make.rb | 19 - spec/makers/css_maker_spec.rb | 52 -- spec/makers/html_maker_spec.rb | 37 -- spec/spec_helper.rb | 11 - 25 files changed, 134 insertions(+), 813 deletions(-) delete mode 100644 .htaccess delete mode 100644 .rspec create mode 100644 Assetfile rename assets/{eric.20060929015500.png => images/eric.png} (100%) rename 404.html => assets/statics/404.html (100%) rename crossdomain.xml => assets/statics/crossdomain.xml (100%) rename humans.txt => assets/statics/humans.txt (100%) rename robots.txt => assets/statics/robots.txt (100%) rename assets/{boilerplate.less => stylesheets/_boilerplate.less} (100%) create mode 100644 assets/stylesheets/_frame.less rename assets/{ => stylesheets}/cv.less (95%) rename assets/{ => stylesheets}/index.less (50%) rename cv.slim => assets/templates/cv.slim (100%) rename index.slim => assets/templates/index.slim (87%) rename layout.slim => assets/templates/layout.slim (81%) delete mode 100644 lib/makers/css_maker.rb delete mode 100644 lib/makers/html_maker.rb delete mode 100644 script/.gitkeep delete mode 100644 script/make.rb delete mode 100644 spec/makers/css_maker_spec.rb delete mode 100644 spec/makers/html_maker_spec.rb delete mode 100644 spec/spec_helper.rb diff --git a/.gitignore b/.gitignore index b1e0774..09661b7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ *.swp -assets/*.*.css *.html -!404.html +public +tmp diff --git a/.htaccess b/.htaccess deleted file mode 100644 index bfb0ba9..0000000 --- a/.htaccess +++ /dev/null @@ -1,540 +0,0 @@ -# Apache configuration file -# httpd.apache.org/docs/2.2/mod/quickreference.html - -# Note .htaccess files are an overhead, this logic should be in your Apache config if possible -# httpd.apache.org/docs/2.2/howto/htaccess.html - -# Techniques in here adapted from all over, including: -# Kroc Camen: camendesign.com/.htaccess -# perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/ -# Sample .htaccess file of CMS MODx: modxcms.com - - -### -### If you run a webserver other than Apache, consider: -### github.com/h5bp/server-configs -### - - - -# ---------------------------------------------------------------------- -# Better website experience for IE users -# ---------------------------------------------------------------------- - -# Force the latest IE version, in various cases when it may fall back to IE7 mode -# github.com/rails/rails/commit/123eb25#commitcomment-118920 -# Use ChromeFrame if it's installed for a better experience for the poor IE folk - - - Header set X-UA-Compatible "IE=Edge,chrome=1" - # mod_headers can't match by content-type, but we don't want to send this header on *everything*... - - Header unset X-UA-Compatible - - - - -# ---------------------------------------------------------------------- -# Cross-domain AJAX requests -# ---------------------------------------------------------------------- - -# Serve cross-domain Ajax requests, disabled by default. -# enable-cors.org -# code.google.com/p/html5security/wiki/CrossOriginRequestSecurity - -# -# Header set Access-Control-Allow-Origin "*" -# - - -# ---------------------------------------------------------------------- -# CORS-enabled images (@crossorigin) -# ---------------------------------------------------------------------- - -# Send CORS headers if browsers request them; enabled by default for images. -# developer.mozilla.org/en/CORS_Enabled_Image -# blog.chromium.org/2011/07/using-cross-domain-images-in-webgl-and.html -# hacks.mozilla.org/2011/11/using-cors-to-load-webgl-textures-from-cross-domain-images/ -# wiki.mozilla.org/Security/Reviews/crossoriginAttribute - -# -# -# # mod_headers, y u no match by Content-Type?! -# -# SetEnvIf Origin ":" IS_CORS -# Header set Access-Control-Allow-Origin "*" env=IS_CORS -# -# -# - - -# ---------------------------------------------------------------------- -# Webfont access -# ---------------------------------------------------------------------- - -# Allow access from all domains for webfonts. -# Alternatively you could only whitelist your -# subdomains like "subdomain.example.com". - -# -# -# Header set Access-Control-Allow-Origin "*" -# -# - - - -# ---------------------------------------------------------------------- -# Proper MIME type for all files -# ---------------------------------------------------------------------- - - -# JavaScript -# Normalize to standard type (it's sniffed in IE anyways) -# tools.ietf.org/html/rfc4329#section-7.2 -AddType application/javascript js - -# Audio -AddType audio/ogg oga ogg -AddType audio/mp4 m4a - -# Video -AddType video/ogg ogv -AddType video/mp4 mp4 m4v -AddType video/webm webm - -# SVG -# Required for svg webfonts on iPad -# twitter.com/FontSquirrel/status/14855840545 -AddType image/svg+xml svg svgz -AddEncoding gzip svgz - -# Webfonts -AddType application/vnd.ms-fontobject eot -AddType application/x-font-ttf ttf ttc -AddType font/opentype otf -AddType application/x-font-woff woff - -# Assorted types -AddType image/x-icon ico -AddType image/webp webp -AddType text/cache-manifest appcache manifest -AddType text/x-component htc -AddType application/x-chrome-extension crx -AddType application/x-opera-extension oex -AddType application/x-xpinstall xpi -AddType application/octet-stream safariextz -AddType application/x-web-app-manifest+json webapp -AddType text/x-vcard vcf - - - -# ---------------------------------------------------------------------- -# Allow concatenation from within specific js and css files -# ---------------------------------------------------------------------- - -# e.g. Inside of script.combined.js you could have -# -# -# and they would be included into this single file. - -# This is not in use in the boilerplate as it stands. You may -# choose to name your files in this way for this advantage or -# concatenate and minify them manually. -# Disabled by default. - -# -# Options +Includes -# AddOutputFilterByType INCLUDES application/javascript application/json -# SetOutputFilter INCLUDES -# -# -# Options +Includes -# AddOutputFilterByType INCLUDES text/css -# SetOutputFilter INCLUDES -# - - -# ---------------------------------------------------------------------- -# Gzip compression -# ---------------------------------------------------------------------- - - - - # Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/ - - - SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding - RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding - - - - # HTML, TXT, CSS, JavaScript, JSON, XML, HTC: - - FilterDeclare COMPRESS - FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html - FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css - FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain - FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml - FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component - FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript - FilterProvider COMPRESS DEFLATE resp=Content-Type $application/json - FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xml - FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xhtml+xml - FilterProvider COMPRESS DEFLATE resp=Content-Type $application/rss+xml - FilterProvider COMPRESS DEFLATE resp=Content-Type $application/atom+xml - FilterProvider COMPRESS DEFLATE resp=Content-Type $application/vnd.ms-fontobject - FilterProvider COMPRESS DEFLATE resp=Content-Type $image/svg+xml - FilterProvider COMPRESS DEFLATE resp=Content-Type $image/x-icon - FilterProvider COMPRESS DEFLATE resp=Content-Type $application/x-font-ttf - FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype - FilterChain COMPRESS - FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no - - - - # Legacy versions of Apache - AddOutputFilterByType DEFLATE text/html text/plain text/css application/json - AddOutputFilterByType DEFLATE application/javascript - AddOutputFilterByType DEFLATE text/xml application/xml text/x-component - AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml - AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype - - - - - -# ---------------------------------------------------------------------- -# Expires headers (for better cache control) -# ---------------------------------------------------------------------- - -# These are pretty far-future expires headers. -# They assume you control versioning with cachebusting query params like -#