Coda Chang Coda Chang - 6 months ago 55
Sass (Sass) Question

Rails use sass to import all css

I use rails and bootstrap by using this bootstrap-sass

I've moved

, so I can't use
*= require_tree

There are bunch of css files in
, how can I import them?

I tried following ways but all of these seems not work.

@import "freelancer";
@import "freelancer.css";
@import "freelancer.css"!force;


I recently found out that there is a way to
all file, check sass-rails

When in Rails, there is a special import syntax that allows you to glob imports relative to the folder of the stylesheet that is doing the importing.

@import "mixins/*" will import all the files in the mixins folder
@import "mixins/**/*" will import all the files in the mixins tree


Scss being a superset of css, you can just change your .css extension to .scss, it will still work in the same way.

Then you can require them like this, and it should work:

@import "freelancer";