【问题标题】:Error: File to import not found or unreadable. Only with scss files错误:找不到要导入的文件或无法读取。仅适用于 scss 文件
【发布时间】:2013-11-04 19:17:03
【问题描述】:

即使文件为空,我在导入扩展名为 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

【问题讨论】:

  • 你试过没有扩展吗?

标签: ruby-on-rails heroku sass rake asset-pipeline


【解决方案1】:

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

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

成功了!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-10-26
    • 1970-01-01
    • 2018-07-04
    • 2019-04-04
    • 1970-01-01
    • 2017-04-11
    • 1970-01-01
    • 2012-03-29
    相关资源
    最近更新 更多