Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 基础SCS指南针、Gruntjs和Boor安装_Css_Sass_Gruntjs_Zurb Foundation_Compass Sass - Fatal编程技术网

Css 基础SCS指南针、Gruntjs和Boor安装

Css 基础SCS指南针、Gruntjs和Boor安装,css,sass,gruntjs,zurb-foundation,compass-sass,Css,Sass,Gruntjs,Zurb Foundation,Compass Sass,可能的双人 因此,我: -models -public ─bower_components ├───fastclick │ └───lib ├───foundation │ ├───css │ ├───js │ │ ├───foundation │ │ └───vendor │ └───scss │ └───foundation │

可能的双人

因此,我:

-models
-public
    ─bower_components
     ├───fastclick
     │   └───lib
     ├───foundation
     │   ├───css
     │   ├───js
     │   │   ├───foundation
     │   │   └───vendor
     │   └───scss
     │       └───foundation
     │           └───components

Gruntfile.js
package.json
我的Grunfile.js

module.exports = function(grunt) {

    require('load-grunt-tasks')(grunt);

    grunt.initConfig({
      compass: {                  // Task
        dist: {                   // Target
          options: {              // Target options
            sassDir: 'public/scss',
            cssDir: 'public/stylesheets',
            environment: 'production',
            require: 'zurb-foundation',
            importPath: 'public/bower_components/foundation/scss',
            cacheDir: 'public/.sass_cache',
          }
        }
      },

      watch: {
        css: {
            files: ['public/scss/_settings.scss'],
            tasks: ['compass:dist'],
            option: { 
                spawn: false, 
                livereload: true
            }
        }
      }
    });

}
使用命令时:
grunt compass

Running "compass:dist" (compass) task
Nothing to compile. If you're trying to start a new project, you have left off the directory argument.
Run "compass -h" to get help.

Done, without errors.

它不起作用。。。指南针不编译我的SCS。。。我怎样才能更正呢?

我相信您必须注册您的任务。像这样:

module.exports = function(grunt) {

  // Configuration goes here
  grunt.initConfig({                  
    // blah
  });  

  // Define your tasks here
  grunt.registerTask('default', ['compass', 'watch']);
  grunt.registerTask('justCompass', ['compass']);
};

现在只需调用
grunt
即可同时运行compass和watch,或者调用
grunt justCompass
仅运行compass任务。

除了注册任务外,还需要读取package.json文件

module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json')
    // all the other code
  });
};