Css 使用Compass编译-要导入的文件找不到或不可读

Css 使用Compass编译-要导入的文件找不到或不可读,css,import,compilation,sass,Css,Import,Compilation,Sass,我想用指南针做一个项目,但这让我很想把我的头发扯下来。 当我编译我的SCS时,我得到了一个错误 它编译的完整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/com

我想用指南针做一个项目,但这让我很想把我的头发扯下来。 当我编译我的SCS时,我得到了一个错误

它编译的完整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文件夹的其他文件一样。 这只是一个猜测,因为不清楚您在哪里找到您的sass_目录,例如

sass_dir = "sass"

在config.rb中,但您可以尝试一下。

您必须在sass编译器中添加选项-compass-like-sourcemap=none,这样就可以了

不,它前面的/不起作用。如果删除重置导入,则下一次导入将出现错误。它只在没有导入时编译。Sass dir在我的配置中是Sass。那么错误是否更改了?您现在可能需要调整所有路径,使其以../partials/etc等开头,至少它们必须从同一根开始。应仅取决于您的设置。partials文件夹位于SCSS文件夹中。当我将导入的文件移动到与SCS相同的文件夹中时,导入工作正常,即@import'reset';我只是个白痴,把文件路径放错了吗?很高兴它现在对你有用。尽管看起来导入/path/etc仍然存在问题,但至少您得到了css。您的分区路径是否如下所示:C:/Users/Tom.PC/lp/sass/partials/_reset.scss?是的,这是文件路径。我有project文件夹,里面有sass缓存文件夹,CSS文件夹,然后是sass文件夹,里面有partials文件夹。如果您查看提供的图像,OP正在使用compass命令。此外,该错误表示正在搜索compass目录。