这是我的grunt文件,运行“grunt nj”或“grunt nu”工作正常, “grunt watch -v -d”也可以,当文件更改时,终端显示文件更改日志,但根本不运行任务。搜索了很多,没有找到类似的案例或解决方案。
var setting = require('./local').setting
setting.env = 'production'
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json')
,uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
,report: ['min']
}
,dist: {
files: [{
expand: true
,cwd: 'public/js/dev'
,src: '*.js'
,dest: 'public/js'
}]
}
}
,jade: {
compile: {
options: {
data: setting
}
,files: [{
expand: true
,cwd: 'views'
,src: '*.jade'
,ext: '.html'
,dest: 'public'
}]
}
}
,watch: {
js: {
files: ['public/js/dev/*.js']
,task: ['nu']
}
,jade: {
files: ['views/*.jade', 'views/include/*.jade']
,task: ['nj']
}
}
})
grunt.loadNpmTasks('grunt-contrib-uglify')
grunt.loadNpmTasks('grunt-contrib-jade')
grunt.loadNpmTasks('grunt-contrib-watch')
grunt.loadNpmTasks('grunt-newer')
grunt.registerTask('nu', ['newer:uglify'])
grunt.registerTask('nj', ['newer:jade'])
grunt.registerTask('default', ['newer:uglify', 'newer:jade'])
}
答案 0 :(得分:0)
尝试
watch: {
js: {
files: ['public/js/dev/*.js'],
task: ['newer:uglify']
}
答案 1 :(得分:0)
有一个&#39;缺少任务:
$('#selectall').click(function () {
$('.mycheckbox').prop('checked', $(this).is(':checked'));
});