使用gruntjs,如何观察.coffee文件的更改? [英] Using gruntjs, how do watch for changes in .coffee files?

查看:167
本文介绍了使用gruntjs,如何观察.coffee文件的更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是gruntjs的新手,这里是我的简单gruntfile:

I am new to gruntjs and here is my simple gruntfile:

/* global module:false */
module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    watch: {
      tasks: 'coffee'
    },
    coffee: {
      compile: {
        files: {
          'js/javascript/*.js': ['js/coffeescript/*.coffee'] // 1:1 compile
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-coffee');

  // Default task.
  grunt.registerTask('default', 'coffee');
};

当我运行grunt时,它编译得很好。

When I run grunt it compiles fine. However, when I run grunt watch, it's just waiting and not detecting my changes.

推荐答案

您应该添加文件以观看:

You should add files to watch:

watch: {
  coffee: {
    files: ['js/coffeescript/*.coffee'],
    tasks: 'coffee'
  }
}

示例

这篇关于使用gruntjs,如何观察.coffee文件的更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆