即使文件为空,我也无法导入带扩展名为scss的文件。但是,如果我将该空文件的扩展名更改为css,那么它可以工作!!!
当我将rails版本从3.2.3更改为3.2.15时,一切都开始发生了,因为bootstrap的下拉不起作用。
运行 rails s 命令没问题。但是,当我尝试推送到Heroku时,它会抛出错误:
要导入的文件未找到或不可读:custom.scss。
这是我的 application.css 文件:
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
*= require_tree .
*/
@import "custom.scss"; //or any file with extension .scss it throws error
如果我跑
bundle exec rake assets:precompile
它会抛出相同的错误
File to import not found or unreadable: custom.scss.
Load paths:
c:/Users/jgutierrezco/RubyWorkspace/sample_app_test
c:/Users/jgutierrezco/RubyWorkspace/vendor/assets/stylesheets
(in c:/Users/jgutierrezco/RubyWorkspace/sample_app_test/app/assets/stylesheets/application.css)
(sass):15
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sass-3.2.12/lib/sass/tree/import_node.rb:67:in `rescue in import'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sass-3.2.12/lib/sass/tree/import_node.rb:45:in `import'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sass-3.2.12/lib/sass/tree/import_node.rb:28:in `imported_file'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sass-3.2.12/lib/sass/tree/import_node.rb:37:in `css_import?'
....
....
正如我之前所说,如果我将custom.scss文件更改为custom.css, bundle exec rake assets:precompile 结束时没有错误。
如果我尝试导入EMPTY scss文件,那么它只能通过(我认为)扩展名为 scss 的事实起作用。
我缺少任何配置吗?主要是因为我将版本从3.2.3更改为3.2.15
答案 0 :(得分:5)
在到处游荡之后,bootstrap-sass github存储库中的某个人向我指出了正确的方向。
我必须将 application.css 重命名为 application.scss 。
这就是诀窍!