我通过使用此 bootstrap-sass 使用 rails 和 bootstrap
我已经将 application.css
移动到 application.scss
,所以我不能使用 *= require_tree
。
assets/stylesheets
中有一堆 css 文件,如何导入它们?
我尝试了以下方法,但所有这些似乎都不起作用。
@import "freelancer";
@import "freelancer.css";
@import "freelancer.css"!force;
更新
我最近发现有一种方法可以导入
所有文件,检查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 是 css 的超集,您只需将 .css 扩展名更改为 .scss,它仍然可以以相同的方式工作。
然后你可以像这样要求它们,它应该可以工作:
@import "freelancer";
关于css - Rails 使用 sass 导入所有 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38878007/