[英]Grunt.js Watch Forever
我試圖在守護程序Gruntfile.js
運行watch
任務。
通常,我將執行以下腳本: grunt watch
。
module.exports = function(grunt) {
grunt.initConfig({
concat: {
options: {
separator: ''
},
dist: {
src: ['static/js/**/*.js'],
dest: 'app.js'
}
},
watch: {
files: ['<%= concat.dist.src %>'],
tasks: ['concat']
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
};
我如何重生 grunt watch
作為一個守護進程?
似乎已經對此進行了考慮:
https://github.com/shama/grunt-hub#watching-forever
https://github.com/shama/grunt-hub/issues/3
您可以使用https://github.com/nodejitsu/forever exmaple
forever start gruntstart.js
gruntstart.js:
var exec = require('child_process').exec;
exec('grunt watch > log/grunt.log',
function (error, stdout, stderr) {
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
if (error !== null) {
console.log('exec error: ' + error);
}
});
我是javascript的新手,但我使用以下方法解決了此問題: tmux
即使我關閉控制台, tmux也會繼續觀看:D
http://i.imgur.com/9L04OGe.jpg
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.