简体   繁体   中英

Warning: Task "taskname" not found. Use --force to continue while running grunt

I'm trying to convert .css files to .sass files using 'grunt-sass-convert' npm module. ' Gruntfile.js ' for the same is as follows:

'use strict';

module.exports = function(grunt){
    grunt.loadNpmTasks('grunt-sass-convert');
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        Sass: {
                    options: {
                            // command line options here 
                            style: 'expanded',
                            from: 'css',
                            to: 'sass'
                            },
                    files: {
                            // Target-specific file lists and/or options go here. 
                            cwd: 'style',
                            src: '*.css',
                            filePrefix: '_',
                            dest: 'sass/'
                            }
                        }       

});
grunt.registerTask('default',['Sass']);
};

I referred grunt-sass-convert npm module documentation for writing the GruntFile.js file. While running the grunt command in cmd, I'm getting the following error:

Warning: Task "Sass" not found. Use --force to continue.

Aborted due to warnings.

I went through so many stackoverflow links regarding the same but I'm unable to fix it and All I understood that there's some error in .js file that's why it's throwing the error.

Directory structure I'm using is as here

Thanks..!!

I guess this would help you -

'use strict';

module.exports = function(grunt){
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    Sass: {
      options: {
        // command line options here 
        style: 'expanded',
        from: 'css',
        to: 'sass'
      },
      files: {
        // Target-specific file lists and/or options go here. 
        cwd: 'style',
        src: '*.css',
        file_prefix: '_',
        dest: 'sass/'
      }
    }
  });
  grunt.loadNpmTasks('grunt-sass-convert');
  grunt.registerTask('default',['Sass']);
};

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