简体   繁体   中英

Grunt task not found (grunt-contrib-sass)

Here's my gruntfile.js, it's in the same directory as sass/style.scss and package.json . package.json has grunt , grunt-contrib-sass and grunt-cli installed.

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"]);
};

Any ideas why I'm receiving the task not found error?

Change Saas to saas as shown in the example config.

Note: The correct spelling of the Task name starts with a lowercase ( 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`
};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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