usermatoMacBook-Pro:weixiaoshuo qichunren$ compass init rails .
Compass recommends that you keep your stylesheets in app/stylesheets
instead of the Sass default location of public/stylesheets/sass.
Is this OK? (Y/n) y
Compass recommends that you keep your compiled css in public/stylesheets/compiled/
instead the Sass default of public/stylesheets/.
However, if you're exclusively using Sass, then public/stylesheets/ is recommended.
Emit compiled stylesheets to public/stylesheets/compiled/? (Y/n) y
directory ./app/stylesheets/
directory ./public/stylesheets/compiled/
exists ./config
create ./config/compass.rb
exists ./config/initializers
create ./config/initializers/compass.rb
convert screen.sass
create ./app/stylesheets/screen.scss
convert print.sass
create ./app/stylesheets/print.scss
convert ie.sass
create ./app/stylesheets/ie.scss
Congratulations! Your rails project has been configured to use Compass.
Just one more thing left to do: Register the compass gem.
In Rails 2.2 & 2.3, add the following to your environment.rb:
config.gem "compass", :version => ">= 0.10.6"
In Rails 3, add the following to your Gemfile:
gem "compass", ">= 0.10.6"
Then, make sure you restart your server.
Sass will automatically compile your stylesheets during the next
page request and keep them up to date when they change.
Next add these lines to the head of your layouts:
%head
= stylesheet_link_tag 'compiled/screen.css', :media => 'screen, projection'
= stylesheet_link_tag 'compiled/print.css', :media => 'print'
/[if IE]
= stylesheet_link_tag 'compiled/ie.css', :media => 'screen, projection'
(You are using haml, aren't you?)
usermatoMacBook-Pro:weixiaoshuo qichunren$