2013-12-11 112 views
0

鉴于此Gruntfile.coffee,我想保留shell:server任务运行并输出到shell,而watch检查前端资产的更改并在运行我的:compile任务时向shell报告。
全部从相同的grunt命令到同一个shell。运行shell命令和监视任务的单个Grunt任务?

module.exports = (grunt) -> 
    grunt.initConfig 
    pkg: grunt.file.readJSON('package.json') 

    coffee: 
     compile: 
     files: 
      'public/js/app.js': 'assets/js/app.coffee' 

    stylus: 
     compile: 
     files: 
      'public/css/app.css': 'assets/css/app.styl' 

    watch: 
     css: 
     files: 'assets/**/*.styl' 
     tasks: 'stylus' 
     javascript: 
     files: 'assets/**/*.coffee' 
     tasks: 'coffee' 

    shell: 
     server: 
     command: 'supervisor index.coffee' 
     options: 
      stdout: true 

    grunt.loadNpmTasks('grunt-contrib-coffee') 
    grunt.loadNpmTasks('grunt-contrib-stylus') 
    grunt.loadNpmTasks('grunt-contrib-watch') 
    grunt.loadNpmTasks('grunt-shell') 

    grunt.registerTask('work', ['default', 'shell:server', 'watch']) 
    grunt.registerTask('default', ['coffee', 'stylus']) 

奖金将消除supervisor赞成使用咕噜声来监视服务器的更改并重新启动Web服务器。

回答

0

选项:

  1. 看的任务之一,提供了一个background: true选项(咕噜 - 卡玛做,例如,IIRC)

  2. 直视​​