尝试学习 Grunt。我已经安装了 grunt-contrib-compass
和 grunt-contrib-watch
插件。当我在终端中使用 grunt
时,它会运行 compass 任务并返回
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 设置:
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 中的 css 或 sass 目录路径,你所做的就是在 Gruntfile.js 中设置 basePath
- 这告诉 compass 在哪里运行,否则它默认与您的 Grunfile 位于同一目录,这显然是错误的。
文档在这里:https://github.com/gruntjs/grunt-contrib-compass
compass: {
uikit: {
options: {
config: 'styles/uikit/config.rb',
basePath: 'styles/uikit',
bundleExec: true
}
}
}
关于javascript - Compass 找不到任何要编译的 Sass 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25706293/