css - Rails 使用 sass 导入所有 css

标签 css ruby-on-rails twitter-bootstrap sass

我通过使用此 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/

相关文章:

ruby-on-rails - rspec 测试载波

html - Bootstrap typeahead 数据源属性

html - body 不透明度影响整个页面?

ruby-on-rails - 带复选框的 Rails HABTM

mysql - 在 rails 中从 mysql 迁移到 postgresql

html - CSS 样式在父样式表中有效,但在子样式表中无效

css - Bootstrap-无法更改导航栏 Logo 大小

css - 内部 div 不会捕捉到容器 div 的顶部

javascript - 每行内都有一个嵌套表的数据表

html - 将文本限制为 Div