我试着用GruntJS来做一个简单的任务,来美化一些js/css,使用grunt-美化插件。这是最基本的任务,我无法得到美化运行没有错误。丑陋的任务运行良好,我只是看不到美化任务的问题。
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// Task configuration.
beautify: {
files: {
src: '../myProject/css*/*.css',
dest: './'
}
},
uglify: {
files: {
src: 'dev/*.css'
}
},
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-beautify');
// Default task.
//grunt.registerTask('default', ['beautify']);
};
Registering "grunt-beautify" local Npm module tasks.
Reading /path/to/grunt/node_modules/grunt-beautify/package.json...OK
Parsing /path/to/grunt/node_modules/grunt-beautify/package.json...OK
Loading "beautify.js" tasks...OK
+ beautify
Loading "Gruntfile.js" tasks...OK
>> No tasks were registered or unregistered.
Running tasks: beautify
Running "beautify" task
[D] Task source: /path/to/grunt/node_modules/grunt-beautify/tasks/beautify.js
Running "beautify:files" (beautify) task
[D] Task source: /path/to/grunt/node_modules/grunt-beautify/tasks/beautify.js
Verifying property beautify.files exists in config...OK
Files: ../myProject/css_3.3.6/bootstrap.min.css, ../myProject/css_3.3.6/fonts.css, ../myProject/css_3.3.6/styles.css -> ./
Using beautifier default options.
Warning: Cannot read property 'src' of undefined Use --force to continue.
TypeError: Cannot read property 'src' of undefined
at Object.<anonymous> (/path/to/grunt/node_modules/grunt-beautify/tasks/beautify.js:52:37)
at Object.<anonymous> (/path/to/grunt/node_modules/grunt/lib/grunt/task.js:264:15)
at Object.thisTask.fn (/path/to/grunt/node_modules/grunt/lib/grunt/task.js:82:16)
at Object.<anonymous> (/path/to/grunt/node_modules/grunt/lib/util/task.js:296:30)
at Task.runTaskFn (/path/to/grunt/node_modules/grunt/lib/util/task.js:246:24)
at Task.<anonymous> (/path/to/grunt/node_modules/grunt/lib/util/task.js:295:12)
at /path/to/grunt/node_modules/grunt/lib/util/task.js:222:11
at process._tickCallback (node.js:419:13)
at Function.Module.runMain (module.js:499:11)
at startup (node.js:119:16)
Aborted due to warnings.https://stackoverflow.com/questions/23554410
复制相似问题