Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The implementation option must be passed to the Sass task

Running grunt - I get this error message:

Running "sass:all" (sass) task
Fatal error: The implementation option must be passed to the Sass task

I've tried re-installing grunt, node, npm, dependencies - but I always come back to this error I can't get past.

Should I post my Gruntfile.js? Frankly, this was set up by a third-party and we don't use it often - I'm thinking maybe we should start from the ground up because it is from about 4 years ago originally... but wondering if anyone has seen this error before and knows of a fix/workaround.

like image 630
DrewM Avatar asked Aug 14 '18 20:08

DrewM


1 Answers

With the update to grunt-sass 3, you have to choose whether you want to use node-sass or dart-sass to compile For node-sass you need to install the module with:

$ npm install --save-dev node-sass 

In you gruntfile, you than need to add node-sass as requirement and add the define constant as implementation option:

const sass = require('node-sass');

require('load-grunt-tasks')(grunt);

grunt.initConfig({
    sass: {
        options: {
            implementation: sass,
            sourceMap: true
        },
        dist: {
            files: {
                'main.css': 'main.scss'
            }
        }
    }
});

See also official page for more details: https://www.npmjs.com/package/grunt-sass

like image 90
Th3S4mur41 Avatar answered Sep 26 '22 18:09

Th3S4mur41