我正在jshinting和minification的应用程序上运行jshint,在这两个应用程序中,jshint正在工作,但minification命令根本不起作用。出现这样的错误:
D:\grunt>grunt min
Warning: Task "min" not found. Use --force to continue.
Aborted due to warnings.下面是我的配置文件:
module.exports = function(grunt){
// Project configuration.
grunt.initConfig({
jshint: {
options: {
curly: true,
eqeqeq: true,
eqnull: true,
browser: true,
globals: {
jQuery: true
}
},
myFiles: ['js/**/*.js']
},
min:{
dest : {
src:'js/app.js',
dest:'js/app.min.js'
}
},
});
// Each plugin must be loaded following this pattern
grunt.loadNpmTasks('grunt-contrib-jshint');
}在这个项目中,我安装了以下模块:
grunt, grunt-contrib-jshint, jshint -我不知道我做错了什么..。任何人都可以帮我解决这个问题。
提前谢谢!
发布于 2014-07-23 10:57:01
要缩小您需要的文件,例如,丑陋。
使用以下命令安装它:
npm install grunt-contrib-uglify --save-dev然后,将其添加到Gruntfile文件中
grunt.loadNpmTasks('grunt-contrib-uglify');最后,您必须更改Gruntfile的代码:
grunt.initConfig({
jshint: {
options: {
curly: true,
eqeqeq: true,
eqnull: true,
browser: true,
globals: {
jQuery: true
}
},
myFiles: ['js/**/*.js']
},
uglify:{
dest : {
files: {
'js/app.min.js': ['js/app.js']
}
}
},
});致以问候。
发布于 2014-07-23 10:51:08
https://stackoverflow.com/questions/24908391
复制相似问题