rj487
rj487

Reputation: 4634

Rails use sass to import all css

I use rails and bootstrap by using this bootstrap-sass

I've moved application.css to application.scss, so I can't use *= require_tree.

There are bunch of css files in assets/stylesheets, 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;

Update

I recently found out that there is a way to import 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

Upvotes: 3

Views: 2171

Answers (1)

Ruff9
Ruff9

Reputation: 1202

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";

Upvotes: 1

Related Questions