sindresorhus / grunt-sass

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

ReferenceError: sass is not defined #289

Closed davebat closed 6 years ago

davebat commented 6 years ago

Hi, I have just updated to 3.0.1, and now whenever I run any of my tasks I get the message:

ReferenceError: sass is not defined

My package.json

{
  "version": "1.0.0",
  "name": "test",
  "private": true,
  "devDependencies": {
    "grunt": "^1.0.3",
    "grunt-contrib-clean": "^1.1.0",
    "grunt-contrib-copy": "^1.0.0",
    "grunt-contrib-handlebars": "^1.0.0",
    "grunt-contrib-uglify": "^3.0.1",
    "grunt-sass": "^3.0.1",
    "grunt-svgmin": "^4.0.0",
    "load-grunt-tasks": "^3.3.0"
  },
  "dependencies": {}
}

and my grunt file

/// <binding AfterBuild='clean, handlebars, uglify, sass, svgmin, copy' />

module.exports = function (grunt) {
    require('load-grunt-tasks')(grunt);

    var jqueryPath = 'assets/js/vendor/jquery/';
    var customPath = 'assets/js/custom/';

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),

        clean: {
            js: ['wwwroot/js/*'],
            css: ['wwwroot/css/*'],
            fonts: ['wwwroot/fonts/*'],
            images: ['wwwroot/images/*']
        },

        svgmin: {
            dist: {
                files: {
                    'wwwroot/images/logo.svg': 'assets/images/vector/logo.svg'
                }
            }
        },

        handlebars: {
            compile: {
                src: 'assets/templates/*.hbs',
                dest: 'assets/js/custom/templates.js',
            },
            options: {
                namespace: 'Templates'
            }
        },

        sass: {
            options: {
                implementation: sass,
                sourceMap: true
            },
            dist: {
                files: {
                    'wwwroot/css/site.min.css': 'assets/scss/site.scss'
                }
            }
        },

        uglify: {
            options: {
                mangle: false,
                compress: false
            },
            js: {
                files: {
                    'wwwroot/js/site.min.js': [
                        jqueryPath + 'jquery.js',
                        jqueryPath + 'jquery.validate.js',
                        jqueryPath + 'jquery.validate.unobtrusive.js',
                        jqueryPath + 'additional-methods.js',
                        jqueryPath + 'jquery.mask.js',
                        'assets/js/vendor/*.js',
                        customPath + 'helper-methods.js',
                        customPath + 'custom-validation.js',
                        customPath + 'snackbar.js',
                        customPath + '*.js'
                    ]
                }
            }
        },

        copy: {
            fonts: {
                files: [{
                    expand: true,
                    src: ['assets/fonts/*'],
                    dest: 'wwwroot/fonts/',
                    flatten: true
                }],
            },
            images: {
                files: [{
                    expand: true,
                    src: ['assets/images/other/*'],
                    dest: 'wwwroot/images/',
                    flatten: true
                }]
            }
        }

    });

    grunt.registerTask('UpdateJS', ['clean:js', 'handlebars', 'uglify']);
    grunt.registerTask('UpdateCSS', ['clean:css', 'sass']);
    grunt.registerTask('UpdateImages', ['clean:images', 'svgmin:dist', 'copy:images']);

    grunt.registerTask('default', ['clean', 'handlebars', 'uglify', 'sass', 'svgmin', 'copy']);
}

Any ideas, what is wrong?

sindresorhus commented 6 years ago

The error is already clear enough if you Google it.

https://github.com/sindresorhus/grunt-sass/releases/tag/v3.0.0