there are some js files in static/js/
1. a.js 2. b.js 3. c.js
how to config grunt.js to get below files:
1. a.min.js 2. b.min.js 3. c.min.js
as far, I have to type specific file name:
min: { dist: { src: 'js/**/*.js', dest: 'js/min/xxx.min.js' } }
Grunt Configuration Task configuration is specified in your Gruntfile via the grunt. initConfig method. This configuration will mostly be under task-named properties, but may contain any arbitrary data.
loadNpmTasks('grunt-contrib-uglify'); } Minification of JS files can now be achieved by running the command. grunt uglify. But a task, or a set of tasks, can be run together under an "alias task". The grunt.registerTask function serves this purpose.
Had the same problem and found a solution that would automatically minify all my scripts separately:
uglify: { build: { files: [{ expand: true, src: '**/*.js', dest: 'build/scripts', cwd: 'app/scripts' }] } }
In grunt 0.4 you can specify multiple dest/src pairs like this:
uglify: { dist: { files: { 'dist/main.js': 'src/main.js', 'dist/widget.js': 'src/widget.js' } } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With