1

即使文件为空,我在导入扩展名为 scss 的文件时也会出错。但是,如果我将该空文件的扩展名更改为 css,它就可以了!!!

当我将 rails 版本从 3.2.3 更改为 3.2.15 时,一切都开始发生了,因为引导程序的下拉菜单不起作用。

我运行我的 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

有没有我缺少的配置?主要是因为我将 rails 从 3.2.3 版本更改为 3.2.15

4

1 回答 1

5

在到处游荡之后,bootstrap-sass github 存储库中的某个人为我指出了正确的方向。

我不得不将我的application.css重命名为application.scss

那成功了!

于 2013-11-04T22:02:20.227 回答