Gruntjs: why compiled scss to empty file? using grunt

I am trying to compile scss file using the grunt-contrib-sass plugin (with grunt v0.4.0). The compiled result is an empty css file. Below are the base.scss, Gruntfile.js and package.json files.

base.scss

$color: #000;

header{
color: $color;  
}

Gruntfile.js

module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
    // Metadata.
    pkg: grunt.file.readJSON('package.json'),       
    sass: {
        dist: {
            options: { style: "expanded", trace: true },
            files: { "base.css": "base.scss" }
        }       
    }
});

grunt.loadNpmTasks('grunt-contrib-sass');

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

package.json

{
"name": "my_grunt",
"version": "1.0.0",
"description": "New to Grunt",
"main": "index.js",
"scripts": {
    "test": "test"
},
"repository": {
    "type": "git",
    "url": "none"
},
"keywords": [
        "none"
],
"author": "none",
"license": "BSD",
"devDependencies": {
        "grunt-contrib-sass": "~0.2.2"
}
}

Result:

Either I run the sass command "grunt sass" or "grunt sass--", the result is just an empty css file without any errors.

Your help is greatly appreciated

Niusaul


If you haven't installed Grunt globally, you'll either do that or add Grunt as a dependency. Otherwise Grunt won't work.

To install Grunt globally run npm install -g grunt-cli in your Terminal or add as a "devDependency":

"devDependencies": {
      "grunt": "0.4.x",
      "grunt-contrib-sass": "0.7.x",
   }

Edit: While searching on Google about this problem, I stumpled upon a reported bug on Github from the same user where his problem is solved. Just for everyone who may experienced the same problem, this was his solution:

The error is caused by the manual config that I've set in the Command Processor (Windows registry), from which I've added an autorun to change the default command prompt.

链接地址: http://www.djcxy.com/p/78964.html

上一篇: 咕噜指南针和手表编写缓慢

下一篇: Gruntjs:为什么编译scss来清空文件? 使用咕噜声