一直是waitring。。。。
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch : {
jade : {
files : ['view/**'],
options : {
livereload : true
}
},
js : {
files : ['punlic/js/**', 'models/**/*.js', 'sechemas/**/*.js'],
//task : ['jshint'],
options : {
livereload : true
}
}
},
nodemon : {
dev : {
options : {
files : "app.js",
script:'app.js',
args : [],
ignoredFiles : ['README.md', 'node_modules/**', '.DS_Store'],
watchedExtensions : ['js'],
watchedFolders : ['app', 'config'],
debug : true,
delayTime : 1,
env : {
PORT : 3000
},
cwd : __dirname
}
}
},
concurrent : {
task : ['nodemon', 'watch'],
options : {
logConcurrentOutput : true
}
}
})
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-nodemon');
grunt.loadNpmTasks('grunt-concurrent');
grunt.option('force', false);
grunt.registerTask('default', ['concurrent'])
}
2014-10-11
正常:
Running "concurrent:tasks" (concurrent) task
Running "watch" task
Waiting...
Running "nodemon:dev" (nodemon) task
[nodemon] v1.2.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node app.js`
2014-10-11
查了stackoverflow(http://stackoverflow.com/questions/21234304/grunt-wont-load-the-node-server)
Just change you options.file to script or keep both.
nodemon: {
? ?dev: {
? ? ? ?script: 'app.js',
? ? ? ?options: {
? ? ? ? ? ?file: 'app.js',
2014-10-10
這是完整的配置代碼:
2014-09-29
下面是我的gruntfile,,本機上能運行,僅供參考
module.exports = function(grunt){
? grunt.initConfig({
? ? watch:{
? ? ? jade:{
? ? ? ? files: ['views/**'],
? ? ? ? options:{
? ? ? ? ? livereload: true
? ? ? ? }
? ? ? },
? ? ? js: {
? ? ? ? files:['public/js/**', 'models/**/*.js', 'schemas/**/*.js'],
? ? ? ? tasks:['jshint'],
? ? ? ? options:{
? ? ? ? ? livereload: true
? ? ? ? }
? ? ? }
? ? },
? ? nodemon: {
? ? ? dev:{
? ? ? ? script:'app.js',
? ? ? ? options: {
? ? ? ? ? args: [],
? ? ? ? ? ignore: ['README.md', 'node_modules/**', 'DS_Store'],
? ? ? ? ? ext: 'js',
? ? ? ? ? watch: ['./'],
? ? ? ? ? nodeArgs: ['--debug'],
? ? ? ? ? delay: 1000,
? ? ? ? ? env:{
? ? ? ? ? ? PORT: 3000
? ? ? ? ? },
? ? ? ? ? cwd: __dirname
? ? ? ? }
? ? ? }
? ? },
? ? concurrent: {
? ? ? tasks: ['nodemon', 'watch'],
? ? ? options: {
? ? ? ? logConcurrentOutput: true
? ? ? }
? ? }
? });
? grunt.loadNpmTasks('grunt-contrib-watch');
? grunt.loadNpmTasks('grunt-nodemon');
? grunt.loadNpmTasks('grunt-concurrent');
? grunt.option('force',true);
? grunt.registerTask('default',['concurrent']);
? //grunt.registerTask('dev',['nodemon']);
? //grunt.registerTask('wa',['watch']);
}