簡體   English   中英

使用Compass進行編譯-找不到或無法讀取的導入文件

[英]Compiling with Compass - File to import not found or unreadable

我正在嘗試將Compass用於一個項目,但這使我想扯掉我的頭發。 編譯SCSS時,出現錯誤。

它編譯的完整CSS如下:

/*
Error: File to import not found or unreadable: partials/reset.
   Load paths:
     Compass::SpriteImporter
     C:/Users/Tom.PC/lp/sass
     C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-core-1.0.1/stylesheets
    on line 2 of C:/Users/Tom.PC/lp/sass/main.scss

1: @import 'compass';
2: @import 'partials/reset';
3: @import '/partials/fonts';
4: @import '/partials/mediaqueries';
5:     
6: body {
7:     font-family: mouse-deco, sans-serif;

Backtrace:
C:/Users/Tom.PC/lp/sass/main.scss:2
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/tree/import_node.rb:66:in     `rescue in import'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/tree/import_node.rb:45:in `import'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/tree/import_node.rb:28:in `imported_file'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/tree/import_node.rb:37:in `css_import?'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/tree/visitors/perform.rb:294:in `visit_import'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/tree/visitors/base.rb:36:in `visit'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/tree/visitors/perform.rb:152:in `block in visit'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/stack.rb:79:in `block in with_base'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/stack.rb:115:in `with_frame'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/stack.rb:79:in `with_base'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/tree/visitors/perform.rb:152:in `visit'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/tree/visitors/base.rb:52:in `block in visit_children'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/tree/visitors/base.rb:52:in `map'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/tree/visitors/base.rb:52:in `visit_children'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/tree/visitors/perform.rb:161:in `block in visit_children'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/tree/visitors/perform.rb:173:in `with_environment'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/tree/visitors/perform.rb:160:in `visit_children'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/tree/visitors/base.rb:36:in `block in visit'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/tree/visitors/perform.rb:180:in `visit_root'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/tree/visitors/base.rb:36:in `visit'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/tree/visitors/perform.rb:151:in `visit'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/tree/visitors/perform.rb:8:in `visit'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/tree/root_node.rb:36:in `css_tree'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/tree/root_node.rb:20:in `render'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/engine.rb:268:in `render'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-import-once-1.0.5/lib/compass/import-once/engine.rb:17:in `block in render'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-import-once-1.0.5/lib/compass/import-once/engine.rb:29:in `with_import_scope'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-import-once-1.0.5/lib/compass/import-once/engine.rb:16:in `render'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/plugin/compiler.rb:486:in `update_stylesheet'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/plugin/compiler.rb:214:in `block in update_stylesheets'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/plugin/compiler.rb:208:in `each'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/plugin/compiler.rb:208:in `update_stylesheets'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.0/lib/sass/plugin/compiler.rb:291:in `watch'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-1.0.1/lib/compass/sass_compiler.rb:46:in `watch!'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-1.0.1/lib/compass/commands/watch_project.rb:41:in `perform'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-1.0.1/lib/compass/commands/base.rb:18:in `execute'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-1.0.1/lib/compass/commands/project_base.rb:19:in `execute'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-1.0.1/lib/compass/exec/sub_command_ui.rb:43:in `perform!'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-1.0.1/lib/compass/exec/sub_command_ui.rb:15:in `run!'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-1.0.1/bin/compass:30:in `block in <top (required)>'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-1.0.1/bin/compass:44:in `call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-1.0.1/bin/compass:44:in `<top (required)>'
C:/Ruby200-x64/bin/compass:23:in `load'
C:/Ruby200-x64/bin/compass:23:in `<main>'
*/
body:before {
  white-space: pre;
  font-family: monospace;
  content: "Error: File to import not found or unreadable: partials/reset.\A        Load paths:\A          Compass::SpriteImporter\A          C:/Users/Tom.PC/lp/sass\A          C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-core-1.0.1/stylesheets\A         on line 2 of C:/Users/Tom.PC/lp/sass/main.scss\A \A 1: @import 'compass';\A 2: @import 'partials/reset';\A 3: @import '/partials/fonts';\A 4: @import '/partials/mediaqueries';\A 5:     \A 6: body {\A 7:     font-family: mouse-deco, sans-serif;"; }

我希望這是一個簡單的修復程序,但是我正在努力查看錯誤是什么。 它是gem本身還是由我的SCSS代碼引起?

你應該嘗試改變

@import 'partials/reset';

進入

@import '/partials/reset';

就像已經在partials-folder的其他文件中一樣。
只是一個猜測,因為尚不清楚您在哪里找到sass_dir ,例如

sass_dir = "sass"

在您的config.rb ,但是您可以嘗試一下。

您必須將選項添加到您的sass編譯器--compass--sourcemap=none ,這樣就可以

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM