【发布时间】:2014-01-09 00:11:07
【问题描述】:
我是 Node.js 和 Grunt 的新手...我正在尝试在 Windows 服务器上使用 Node.js 和 Grunt 来查看我的 main.less 文件并进行标准编译和连接。我可以在命令提示符打开时执行此操作,但我需要在未登录到服务器的情况下将其作为守护程序运行,因为 .less 文件是从位于云中的 CMS 部署的。
我在 Grunt-Forever 中找到了有前途的文档,但它需要您指向一个应用程序,而我只想执行 grunt watch 任务。
9 个月前有人问过类似的问题,但没有人给出答案: Grunt.js Watch Forever
我从命令行尝试了这个:
FWIW,你可以永远做 /usr/local/bin/grunt --base 。 watch 与 grunt watch atm 一起使用。
但是,我遇到了错误。
这是我的 gruntfile:
module.exports = function(grunt) {
grunt.registerTask('watch', [ 'watch' ]);
grunt.initConfig({
concat: {
js: {
src: [
'js/global.js','js/googlemap.js'
],
dest: 'js/main.min.js'
},
},
uglify: {
options: {
mangle: false
},
js: {
files: {
'js/main.min.js': ['js/main.min.js']
}
}
},
less: {
style: {
files: {
"css/style.css": "less/main.less"
}
}
},
watch: {
js: {
files: ['js/global.js','js/googlemap.js'],
tasks: ['concat:js', 'uglify:js']
},
css: {
files: ['less/*.less'],
tasks: ['less:style']
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
};
非常感谢任何帮助!
【问题讨论】:
-
您需要指定错误是什么。