Automatically build sprites with Lemonade
How it works
Unfortunately, the gem has a few problems:
- it does not work with Sass2
- it always generates all sprites when the sass file changes, which is too slow for big projects
- it expects a folder structure quite different to our usual
All these problems are solved for us, in our own lemonade fork. This fork has since been merged to the original gem, maybe we can use that one now too.
gem install compass -v=0.10.2
gem install chunky_png -v=0.8.0
- freeze our lemonade version
git clone http://github.com/makandra/lemonade.git lemonade-0.3.4
rm -rf lemonade-0.3.4/.git
config.gem 'compass', :version => '=0.10.2'
config.gem 'lemonade', :version => '=0.3.4'
config.gem 'chunky_png', :version => '=0.8.0'
config/initializers/compass.rb(or copy from development repo):
require 'compass' rails_root = (defined?(Rails) ? Rails.root : RAILS_ROOT).to_s Compass.add_project_configuration(File.join(rails_root, "config", "compass.rb")) Compass.configure_sass_plugin! Compass.handle_configuration_change!
config/compass.rb(or copy from development repo):
# This configuration file works with both the Compass command line tool and within Rails. # Require any additional compass plugins here. project_type = :rails project_path = Compass::AppIntegration::Rails.root # Set this to the root of your project when deployed: http_path = "/"` css_dir = "public/stylesheets" sass_dir = "public/stylesheets/sass" images_dir = "public/images" http_images_path = "../images" environment = Compass::AppIntegration::Rails.env # To enable relative paths to assets via compass helper functions. Uncomment: # relative_assets = true require 'lemonade'
This setup is still not optimal:
- dependency on compass is unnecessary
- installation a bit involved (maybe we can use the usual gem?)