我是Node.js和Grunt的新手......我正在尝试在Windows服务器上使用Node.js和Grunt来观看我的main.less文件并进行标准的编译和连接.我可以在命令提示符打开的情况下执行此操作,但是我需要将其作为守护程序运行,而不是登录到服务器,因为.less文件是从位于云中的CMS部署的.
我在Grunt-Forever中找到了很有前途的文档,但它要求你指向一个应用程序,而我只是想执行grunt watch任务.
其他人在9个月前问了一个类似的问题,但没有人给出答案: Grunt.js永远观看
我从命令行尝试了这个:
FWIW,你可以永远做/ usr/local/bin/grunt --base.注意永远使用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'); };
任何帮助深表感谢!