简体   繁体   English

指南针找不到任何要编译的Sass文件

[英]Compass can't find any Sass files to compile

Trying to learn Grunt. 试图学习咕unt。 I have installed the grunt-contrib-compass ,and grunt-contrib-watch plugins. 我已经安装了grunt-contrib-compassgrunt-contrib-watch插件。 When I use grunt in terminal, it runs the compass task and comes back with 当我在终端中使用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.`

The Gruntfile is in the wp-content/ folder of my Wordpress install. Gruntfile位于我的Wordpress安装的wp-content/文件夹中。 Here is the compass setup in my Grunfile: 这是我的Grunfile中的指南针设置:

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

My config.rb is there, and is setup thusly: 我的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

Any ideas? 有任何想法吗? Where have I gone wrong? 我哪里出问题了?

I had this problem also, you don't have to change the css or sass dir paths in config.rb, all you do is set the basePath in Gruntfile.js - this tells compass where to run from, otherwise it defaults to the same directory as your Grunfile, which is clearly wrong. 我也遇到了这个问题,您不必更改config.rb中的css或sass dir路径,只需在Gruntfile.js中设置basePath即可-告诉罗盘从何处运行,否则默认为相同目录作为您的Grunfile,这显然是错误的。

The docs are here: https://github.com/gruntjs/grunt-contrib-compass 这些文档在这里: https : //github.com/gruntjs/grunt-contrib-compass

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

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

I also have this issue with my first sass project when I wanted to use Susy toolkit. 当我想使用Susy工具包时,我的第一个sass项目也遇到了这个问题。 You should type "compass watch" command from your working directory, and compass will do the rest. 您应该从工作目录中键入“ compass watch”命令,罗盘将完成其余工作。 And then compile the main.scss file. 然后编译main.scss文件。 If it shows like below... 如果显示如下...

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

Then it's working. 然后就可以了。 But at first, you have to configure your config.rb file. 但是首先,您必须配置config.rb文件。

这个:

 sudo npm install --save-dev

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM