我正在尝试使用gruntfile
我uglify
的 JS 和 CSS。一个问题是它uglify
不起作用,终端给出了一个非常模糊的错误......
Gruntfile.js
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify:
{
js:
{
files: { 'compressed/javascript.min.js': ['js/*.js'] }
},
css:
{
files: { 'compressed/css.min.css': ['css/*.css'] }
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-uglify');
// Default task(s).
grunt.registerTask('default', ['uglify']);
};
包.json
{
"name": "my-project-name",
"version": "0.1.0",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-jshint": "~0.6.3",
"grunt-contrib-nodeunit": "~0.2.0",
"grunt-contrib-uglify": "~0.2.2",
"grunt-contrib-imagemin": "~0.3.0"
}
}
终端输出:
MacBook-Pro-van-Valerie:grunt valerieeskens$ grunt
Running "uglify:js" (uglify) task
>> Uglifying source "js/javascript1.js,js/javascript2.js" failed.
Warning: Uglification failed. Use --force to continue.
Aborted due to warnings.
MacBook-Pro-van-Valerie:grunt valerieeskens$
地图结构:http ://d.pr/i/CxVJ