sindresorhus / grunt-sass

Compile Sass to CSS
MIT License
1.01k stars 209 forks source link

Task sass not found - Doc or dep lacking #310

Closed CyberPunkCodes closed 3 years ago

CyberPunkCodes commented 3 years ago

Following the instructions, I was receiving the following error:

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

Digging through old closed issues, I decided to try manually installing load-grunt-tasks. Doing so, fixed the issue. It seems this does not work out of the box following the current README instructions, or at least not if you are using Dart.

load-grunt-tasks should be added to this library's dev dependencies or documented to install it in the README.

For anyone receiving the same error, you need to run:

npm install --save-dev load-grunt-tasks

Then add the require line within the module exports section, like so:

module.exports = function(grunt) {

    require('load-grunt-tasks')(grunt);    /* this line here */

    grunt.initConfig({
        ...
    });
};

Hope that helps someone.

Please add it as a dev dependency, or at least document that you need to install load-grunt-tasks in order for this to work.

sindresorhus commented 3 years ago

It's expected knowledge that you need to npm install anything that is imported. It's also just an example. You don't have to use it. It just makes things simpler. You can manually load the task per the Grunt docs. This is not really the place to document general npm and Grunt things.