【问题标题】:Compass can't find any Sass files to compileCompass 找不到任何要编译的 Sass 文件
【发布时间】:2018-05-14 15:30:17
【问题描述】:

尝试学习咕噜声。我已经安装了grunt-contrib-compassgrunt-contrib-watch 插件。当我在终端中使用grunt 时,它会运行指南针任务并返回

Running "compass:dist" (compass) task
Compass can't find any Sass files to compile.
Is your compass configuration correct?.
If you're trying to start a new project, you have left off the directory argument.
Run "compass -h" to get help.`

Gruntfile 位于我安装的 Wordpress 的 wp-content/ 文件夹中。这是我的 Grunfile 中的指南针设置:

compass: {
    dist: {
        options: {
            config: 'themes/THEME-NAME/config.rb',
            force: true
        }
    }
},

我的 config.rb 在那里,并因此设置:

require 'singularitygs'
require "breakpoint"
http_path = "/"
css_dir = "/"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "javascripts"
output_style = :compressed
line_comments = false

有什么想法吗?我哪里出错了?

【问题讨论】:

  • 将 config.rb 中的路径更改为相对于 Gemfile 所在的位置(例如:sass_dir = "themes/THEME-NAME/sass")给我关于我的奇异性和断点的一系列错误宝石。但它并不像没有要编译的文件一样。进展?

标签: javascript sass gruntjs compass grunt-contrib-compass


【解决方案1】:

我也遇到了这个问题,您不必更改 config.rb 中的 css 或 sass 目录路径,您只需在 Gruntfile.js 中设置 basePath - 这会告诉指南针从哪里运行,否则它默认与您的 Grunfile 位于同一目录,这显然是错误的。

文档在这里:https://github.com/gruntjs/grunt-contrib-compass

compass: {
  uikit: {
    options: {
      config: 'styles/uikit/config.rb',
      basePath: 'styles/uikit',
      bundleExec: true
    }
  }
}

【讨论】:

  • 在 phpstorm 上,您需要将工作目录设置为与输出路径相同
【解决方案2】:

显然,当您在另一个目录中使用 config.rb 时,将您的 config.rb 的变量路径设置为相对于 Gruntfile 的目录,它应该可以正常工作。

【讨论】:

    【解决方案3】:

    当我想使用 Susy 工具包时,我的第一个 sass 项目也遇到了这个问题。您应该从您的工作目录中键入“compass watch”命令,其余的将由 compass 完成。然后编译 main.scss 文件。如果显示如下...

    modified C:/xampp/htdocs/projects/sass/config.rb
    clean C:/xampp/htdocs/projects/sass/css
    delete C:/xampp/htdocs/projects/sass/css/main.css
    write C:/xampp/htdocs/projects/sass/css/main.css
    

    然后它的工作。但首先,你必须配置你的 config.rb 文件。

    【讨论】:

      【解决方案4】:

      这个:

       sudo npm install --save-dev
      

      【讨论】:

      • 这无关紧要,因为如果没有安装 Compass,它根本无法通过 Grunt 运行。
      猜你喜欢
      • 1970-01-01
      • 2013-09-08
      • 2013-11-02
      • 1970-01-01
      • 2012-01-22
      • 2014-07-04
      • 2017-04-26
      • 2015-02-14
      • 1970-01-01
      相关资源
      最近更新 更多