Akashdeep Gupta
Akashdeep Gupta

Reputation: 35

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..!!

Upvotes: 2

Views: 820

Answers (1)

Sk Arif
Sk Arif

Reputation: 1120

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

Upvotes: 1

Related Questions