test/config.rb in ezy-0.0.4 vs test/config.rb in ezy-0.0.5
- old
+ new
@@ -2,9 +2,39 @@
project_type = :stand_alone
http_path = "/"
sass_dir = "scss"
css_dir = "css"
+images_dir = "img"
line_comments = false
preferred_syntax = :scss
output_style = :expanded
relative_assets = true
+
+# ----------------------------------------------------- #
+# Nice sprite names
+#
+
+nice_sprite_names = true
+
+if nice_sprite_names
+ # Rename sprites to remove the Compass-generated hash and move it up 1 directory
+ on_sprite_saved do |filename|
+ if File.exists?(filename)
+ FileUtils.cp filename, filename.gsub(%r{-s[a-z0-9]{10}\.png$}, '.png').gsub('images/../images/', '')
+ end
+ end
+
+ # Replace in stylesheets generated references to sprites
+ # by their counterparts without the hash uniqueness.
+ # Adding timestamp as cache buster.
+ on_stylesheet_saved do |filename|
+ if File.exists?(filename)
+ css = File.read filename
+ File.open(filename, 'w+') do |f|
+ f << css.gsub(%r{-s[a-z0-9]{10}\.png}, '.png?' + Time.now.strftime("%H%M%s"))
+ end
+ end
+ end
+end
+
+# ----------------------------------------------------- #
\ No newline at end of file