Skip to content

Instantly share code, notes, and snippets.

@rizwanreza
Forked from chriseppstein/readme.md
Created October 11, 2011 15:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rizwanreza/1278434 to your computer and use it in GitHub Desktop.
Save rizwanreza/1278434 to your computer and use it in GitHub Desktop.
How to integrate Compass with Rails 3.1 asset pipeline

Compass is even easier to use in Rails 3.1

Compass Rails integration is trivial in rails 3.1. The "config/compass.rb" file is optional now.

During deploy run:

rake assets:precompile

Additional Upgrade instructions

  1. Move your stylesheets from app/stylesheets or public/stylesheets/sass to app/assets/stylesheets.
  2. Rename all non partials to *.css.s[ac]ss

Installing Compass Plugins

  1. Gem based plugins: Add plugin to Gemfile

  2. Archive based plugins: unpack the extension into vendor/plugins/compass_extensions

  3. (optionally) Install the plugin templates. E.g.

    bundle exec compass install <plugin>
    
if defined?(Bundler)
Bundler.require *Rails.groups(:assets => %w(development test))
end
stylesheets_directory = "#{Rails.root}/app/assets/stylesheets"
config.assets.precompile << /(^[^_]|\/[^_])[^\/]*/
# if you prefer `.sass` over `.scss`.
config.sass.preferred_syntax = :sass
group :assets do
gem 'sass-rails', '~> 3.1.0'
gem 'coffee-rails', '~> 3.1.0'
gem 'uglifier'
gem 'compass', '~> 0.12.alpha'
# include other compass plugins here. E.g.:
gem 'compass-susy-plugin', :require => 'susy'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment