sindresorhus / grunt-sass

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

Grunt task results in recursion when the task name is "sass" #300

Closed mohsentaleb closed 4 years ago

mohsentaleb commented 4 years ago

Given the following task description in my GruntFile:

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

module.exports = function (grunt) {
  grunt.initConfig({
   sass: {
      options: {
        implementation: sass,
        //sourceMap: true,
      },
      dist: {
        files: {
          "css/custom-bootstrap.css": "css/scss/custom-bootstrap.scss",
        },
      },
    },
  });

  grunt.loadNpmTasks("grunt-sass");

  // Default task(s).
  grunt.registerTask("sass", ["sass"]);
  grunt.registerTask("default", [""]);
};

when I ran grunt sass , it took forever and then in verbose mode (grunt sass --verbose) I realized it's stuck in a recursion:

λ grunt sass --verbose
Initializing
Command-line options: --verbose, --gruntfile=c:\wwwRoot\template\Gruntfile.js

Reading "Gruntfile.js" Gruntfile...OK

Registering Gruntfile tasks.
Reading package.json...OK
Parsing package.json...OK
Initializing config...OK

Registering "grunt-svgstore" local Npm module tasks.
Reading c:\wwwRoot\template\node_modules\grunt-svgstore\package.json...OK
Parsing c:\wwwRoot\template\node_modules\grunt-svgstore\package.json...OK
Loading "svgstore.js" tasks...OK
+ svgstore

Registering "grunt-sass" local Npm module tasks.
Reading c:\wwwRoot\template\node_modules\grunt-sass\package.json...OK
Parsing c:\wwwRoot\template\node_modules\grunt-sass\package.json...OK
Loading "sass.js" tasks...OK
+ sass
Loading "Gruntfile.js" tasks...OK
+ default, icon, sass

Running tasks: sass

Running "sass" task

Running "sass" task

Running "sass" task

Running "sass" task

Running "sass" task

Running "sass" task

Running "sass" task

Running "sass" task

Running "sass" task

Running "sass" task

Running "sass" task

Running "sass" task

Running "sass" task

Running "sass" task

Running "sass" task

As soon as I rename my task to something else, problem is solved!

sindresorhus commented 4 years ago

This should be reported on the Grunt issue tracker.

mohsentaleb commented 4 years ago

Moved to https://github.com/gruntjs/grunt/issues/1708