0

sass/style.scss这是我的 gruntfile.js,它与和 位于同一目录中package.jsonpackage.jsongruntgrunt-contrib-sassgrunt-cli安装。

module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    // this is where you set up your Sass settings. Once you know what you're doing, you can change thse.
    Sass: {
      dist: {
        options: {
          style: 'compressed'
        },
        files: {
          'style.css': 'sass/style.scss'
        }
      }
    }
  });
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.registerTask('default', ["Sass"]);
};

任何想法为什么我收到未找到任务的错误?

4

1 回答 1

1

更改Saassaas示例配置中所示。

注意:任务名称的正确拼写以小写字母 ( s) 开头。

Gruntfile.js

module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    sass: { // <-- Change to lowercase `s`
      dist: {
        options: {
          style: 'compressed'
        },
        files: {
          'style.css': 'sass/style.scss'
        }
      }
    }
  });
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.registerTask('default', ["sass"]);  // <-- Change to lowercase `s`
};
于 2017-10-16T11:25:33.067 回答