观看SCSS文件,中止任务时出现Grunt错误

时间:2014-05-02 20:55:28

标签: sass gruntjs

我是第一次在项目上设置Grunt,并且在尝试让它看到我的Sass文件时遇到了麻烦。我有我需要安装的所有东西,并且手表正常工作。但是当我在.scss文件中进行更改时,我在终端中收到以下错误消息:

File "css/global.scss" changed.
Running "sass:style" (sass) task
Verifying property sass.style exists in config...ERROR
Unable to process task.
Warning: Required config property "sass.style" missing. Use --force to continue.
Aborted due to warnings. 

我无法弄清楚它所引用的sass.style属性在哪里和/或如何告诉它寻找不同的属性。

我的文件结构如下:

Gruntfile.js
package.json
index.html
css/ --- build/ --- global.css
     --- global.scss
js/  --- build/ --- global.min.js
     --- global.js
node_modules/

My Gruntfile如下所示:

module.exports = function(grunt) {

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
  options: { },
  build: {
    src: ['js/libs/*.js','js/global.js'],
    dest: 'js/build/global.min.js'
  }
},

sass: {
    dist: {
      options: {
        style: 'compressed'
      },
      files: {
        'css/build/global.css':'css/global.scss'
      }
    }
  },

watch: {
 js: {
   files: ['js/*.js'],
   tasks: ['uglify:js'],
   options: {
     livereload: true,
   }
 },
 css: {
   files: ['**/*.scss'],
   tasks: ['sass'],
   options: {
     livereload: true,
   }
 }
},

serve: {
 options: {
     port: 9000
 }
}

});

grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-serve');

grunt.registerTask('default', ['uglify','sass','watch', 'serve']);

};

0 个答案:

没有答案