[JavaScript] 纯文本查看 复制代码
1 module.exports = function (grunt) {
2 grunt.initConfig({
3 watch: {
4 ejs: {
5 files: ['views/**'],
6 options: {
7 livereload: true,
8 },
9 },
10 js: {
11 files: ['public/js/**', 'models/**/*.js', 'schemas/**/*.js'],
12 options: {
13 livereload: true, //文件更新时重新启动服务
14 },
15 },
16 },
17 nodemon: {
18 dev: {
19 file: './bin/www' //根据自己的实际修改
20 }
21 },
22 concurrent: { // 同时执行nodemon和watch任务
23 target: {
24 tasks: ['nodemon', 'watch'],
25 options: {
26 logConcurrentOutput: true
27 }
28 }
29 }
30 });
31
32 // 加载包含 “watch","concurrent","nodemon"任务的插件
33 grunt.loadNpmTasks('grunt-contrib-watch')
34 grunt.loadNpmTasks('grunt-concurrent')
35 grunt.loadNpmTasks('grunt-nodemon');
36
37 grunt.option('force', true)
38 // 默认执行的任务列表
39 grunt.registerTask('default', ['concurrent'])
40 }