Created
January 26, 2012 23:02
-
-
Save mattbrictson/1685685 to your computer and use it in GitHub Desktop.
Install Compass in Rails 3.1/3.2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Precompile *all* assets, except those that start with underscore | |
config.assets.precompile << /(^[^_\/]|\/[^_])[^\/]*$/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* application.scss | |
* | |
* Important! Do *not* use Sprockets "require" syntax. | |
* Use @import to include other stylesheets and Compass mixins. | |
*/ | |
// Include some nice mixins | |
@import "compass/css3"; | |
@import "sassy-buttons"; | |
// Example: import partial stylesheet named "_users.scss" | |
@import "users"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/compass.rb | |
additional_import_paths = ["app/assets/stylesheets/basics", "app/assets/stylesheets/shared"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A ActionView::Template::Error occurred in sessions#new: | |
1024.css isn't precompiled | |
.bundle/bundle/gems/actionpack-3.2.0/lib/sprockets/helpers/rails_helper.rb:142:in `digest_for' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.logo | |
{ | |
background: image-url("logo-small.png") no-repeat; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
group :assets do | |
gem 'compass-rails','~> 1.0.0.rc.2' | |
gem 'compass-colors' | |
gem 'sassy-buttons' | |
gem 'sass-rails', '~> 3.2.3' | |
# non-compass gems omitted for brevity | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ bundle exec rake assets:precompile | |
/Users/mbrictson/.rbenv/versions/1.9.3-p0/bin/ruby script/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets | |
rake aborted! | |
Undefined variable: "$body-text-line-height". | |
(in /Users/mbrictson/Work/rails-project/app/assets/stylesheets/basics/_grid.scss) | |
Tasks: TOP => assets:precompile:primary | |
(See full trace by running task with --trace) | |
rake aborted! | |
Command failed with status (1): [/Users/mbrictson/.rbenv/versions/1.9.3-p0/...] | |
Tasks: TOP => assets:precompile | |
(See full trace by running task with --trace) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
├── Gemfile | |
├── app | |
│ └── assets | |
│ ├── images | |
│ │ └── logo-small.png | |
│ ├── javascripts | |
│ │ └── application.js | |
│ └── stylesheets | |
│ ├── _users.scss | |
│ └── application.scss | |
└── config | |
├── application.rb | |
└── compass.rb |
Just a note, but in 'application.scss', @import "sassybuttons" should be @import "sassy-buttons" as per jhardy/Sassy-Buttons#14
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@mbrictson: That;s true. I'm just using it as a workaround, since
rake assets:precompile
takes sometimes up to 10 minutes with Sprockets and Compass.