Grunt Exiting When It Should Be Watching

雨燕双飞 提交于 2019-12-13 04:02:09

问题


I am developing a node app that interacts with IRC.

My Gruntfile.js:

module.exports = function(grunt) {     
  grunt.initConfig({
    watch: {
      js: {
        files: [
          'index.js',
          'brains.js',
          'lib/*.js'
        ],
        tasks: ['develop'],
        options: { nospawn: true }
      }
    },
    develop: {
      server: {
        file: 'index.js'
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-develop');

  grunt.registerTask('default', ['develop']);

};

When I execute grunt it states that it completed and exits. How can I keep grunt watching like in a web based node app?


回答1:


When you're calling grunt, the default task is running: grunt.registerTask('default', ['develop']);. Run grunt watch instead, or change ['develop'] to ['watch'].



来源:https://stackoverflow.com/questions/21813462/grunt-exiting-when-it-should-be-watching

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!