我正在尝试使用grunt-contrib-uglify
在目录中uglify多个.js文件。我的根目录如下所示:
--src
example-project.js
style.scss
--build
Gruntfile.js
package.JSON
和我的Gruntfile.js看起来像这样:
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
build: {
files: [{
exapand : true,
cwd: 'src',
src: '*.js',
dest: 'build',
ext: '.min.js'
}]
}
},
sass:{
dist: {
files: {
'build/style.css' : 'src/style.scss'
}
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-sass');
// Default task(s).
grunt.registerTask('default', ['uglify', 'sass']);
};
当我尝试在根目录上运行grunt
时,我得到了这个输出:
Running "uglify:build" (uglify) task
>> Source file example-project.js not found.
>> Destination build not written because src files were empty.
>> No files created.
sass部分工作正常。
我已经检查了this link但仍然无法正常工作。