我试图将Compass用于一个项目,但它让我想把头发撕掉。 当我编译我的SCSS时,我得到this错误。
它编译的完整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;"; }
我希望这很容易解决,但我很难看出错误是什么。它是宝石本身还是由我的SCSS代码引起的?
答案 0 :(得分:0)
您应该尝试更改
@import 'partials/reset';
进入
@import '/partials/reset';
喜欢它已经用于partials文件夹的其他文件
这只是猜测,因为您不清楚找到sass_dir
的位置,例如
sass_dir = "sass"
在您的config.rb
中,但您可以尝试一下。
答案 1 :(得分:-1)
你必须向你的sass编译器--compass
添加选项,例如--sourcemap=none
,并且没问题