【问题标题】:Grunt task not found (grunt-contrib-sass)未找到 Grunt 任务 (grunt-contrib-sass)
【发布时间】:2017-10-15 19:17:52
【问题描述】:

这是我的 gruntfile.js,它与 sass/style.scsspackage.json 位于同一目录中。 package.json 已安装 gruntgrunt-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"]);
};

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

【问题讨论】:

    标签: javascript node.js gruntjs grunt-contrib-sass


    【解决方案1】:

    Saas 更改为saas,如example 配置所示。

    注意:任务名称的正确拼写以小写字母 (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`
    };
    

    【讨论】:

      猜你喜欢
      • 2014-04-16
      • 2023-03-12
      • 1970-01-01
      • 2016-09-13
      • 2017-10-15
      • 1970-01-01
      • 2016-04-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多