Reputation: 29787
I'm trying to add Compass to my Rails 3.2 app, using compass-rails. How can I get it to automatically import all of the stylesheets in app/assets/stylesheets
? At the moment I have to manually do @import 'filename';
in application.css.scss
for each one.
Upvotes: 1
Views: 450
Reputation: 6222
If you're using the asset pipeline, this should happen automagically with:
/*
* In application.css
*= require_tree .
*/
Docs: http://guides.rubyonrails.org/asset_pipeline.html#manifest-files-and-directives
The important caveat is "Using Sprockets directives all Sass files exist within their own scope, making variables or mixins only available within the document they were defined in."
If you're heavy on the functions, try having a file like app/assets/stylesheets/base.css.scss
that contains @import
directives (wildcard or not) for all your mixin and var files. Then you only need to @import "base"
once for every stylesheet and can still bundle your css using sprockets directives.
Upvotes: 1
Reputation: 2013
Put all your scss files (except application.css.scss) in a different folder:
/application.css.scss
/all/hello.css.scss
/all/hi.css.scss
application.css.scss file like below will work.
@import "compass";
@import "all/*";
Upvotes: 3