Ber*_*and 19 node.js npm gruntjs compass-sass
我是NodeJS和Grunt的新手,我正在努力做到这一点.这是我得到的:
$> grunt
Loading "Gruntfile.js" tasks...ERROR
>> ReferenceError: grunt is not defined
Warning: Task "default" not found. Use --force to continue.
Aborted due to warnings.
Run Code Online (Sandbox Code Playgroud)
这是我的Gruntfile:
module.exports = function(grunt) {
grunt.initConfig({
compass: {
dist: {
options: {
config: 'config/config.rb'
}
}
}
});
};
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.registerTask('default', 'compass');
Run Code Online (Sandbox Code Playgroud)
这是我的package.json:
{
"name": "tests",
"version": "0.0.0",
"description": "Grunt Tests",
"main": "index.js",
"devDependencies": {
"grunt": "~0.4.2",
"grunt-contrib-compass": "~0.6.0",
"grunt-contrib-watch": "~0.5.3",
"grunt-cli": "~0.1.11"
},
"scripts": {
"test": "grunt compass"
},
"repository": {
"type": "git",
"url": "https://github.com/Bertrand31/grunttests.git"
},
"keywords": [
"Grunt",
"NodeJS",
"NPM",
"SASS",
"Compass"
],
"author": "Bertrand Junqua",
"license": "GPL",
"bugs": {
"url": "https://github.com/Bertrand31/grunttests/issues"
},
"homepage": "https://github.com/Bertrand31/grunttests"
}
Run Code Online (Sandbox Code Playgroud)
哦,我在Debian Wheezy上运行它.
如果您有任何想法,请告诉我.非常感谢!
mat*_*tth 39
您正在调用grunt.loadNpmTasks
并且未定义grunt.registerTask
范围grunt
.你需要在module.exports函数中调用它们:
module.exports = function(grunt) {
grunt.initConfig({
compass: {
dist: {
options: {
config: 'config/config.rb'
}
}
}
});
// Call these here instead, where the variable grunt is defined.
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.registerTask('default', 'compass');
};
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
15314 次 |
最近记录: |