[英]grunt watch is not working and gets hanged
I am new to using grunt. 我是刚使用grunt的人。 I am not been able to use grunt watch.
我无法使用咕unt声手表。 Following is my grunt file:
以下是我的咕unt声文件:
module.exports = function(grunt) {
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
my_target: {
files: {
'public/admin/js/developer.min.js': ['public/admin/js/developer.js']
}
}
},
cssmin: {
target: {
files: {
'public/admin/css/developer2.min.css': ['public/admin/css/developer.css']
}
}
},
csslint: {
strict: {
options: {
import: 2
},
src: ['public/admin/css/developer.css']
},
lax: {
options: {
import: false
},
src: ['public/admin/css/developer.css']
}
},
htmlhint: {
html1: {
options: {
'tag-pair': true
},
src: ['app/views/admin/property/*.php']
}
},
jshint: {
all: ['Gruntfile.js', 'public/admin/js/developer.js'],
options: {
reporter: require('jshint-stylish')
}
},
jslint: { // configure the task
// lint your project's client code
client: {
src: [
'public/admin/js/developer.js'
],
directives: {
browser: true,
predef: [
'jQuery'
]
},
options: {
junit: 'out/client-junit.xml'
}
}
},
qunit: {
qunit: {
all: {
options: {
urls: [
'http://localhost:8000/tests/TestCase.php',
'http://localhost:8000/tests/ExampleTest.php'
]
}
}
}
},
jsvalidate: {
options:{
globals: {},
esprimaOptions: {},
verbose: false
},
targetName:{
files:{
src:['public/admin/js/*.js']
}
}
},
watch: {
files: 'public/admin/js/*.js',
task: ['uglify'],
options: {
nospawn: false
},
},
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-csslint');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-jslint');
grunt.loadNpmTasks('grunt-jsvalidate');
grunt.loadNpmTasks('grunt-htmlhint');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-watch');
// Default task(s).
grunt.registerTask('default', ['uglify'],['cssmin'],['csslint'],['jshint'],['jslint'],['htmlhint'],['jsvalidate'],['qunit'],['watch']);
};
I am trying to run 'uglify' task when there is any change in my .js files but it ain't happening. 我的.js文件中有任何更改但没有发生时,我正在尝试运行“ uglify”任务。 All I get is the following screen it stuck here
我得到的只是下面的屏幕,它被卡在这里
.
。 Kindly help me running this grunt task.
请帮助我运行这个艰巨的任务。 Thank you!!
谢谢!!
You made a small typo. 你打错了字。 Instead of "task" inside the watch configuration block it should be "tasks"
而不是监视配置块中的“任务”,应该是“任务”
watch: {
files: 'public/admin/js/*.js',
tasks: ['uglify'],
options: {
nospawn: false
},
},
Source: https://github.com/gruntjs/grunt-contrib-watch 资料来源: https : //github.com/gruntjs/grunt-contrib-watch
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.