Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1. a.js
- 2. b.js
- 3. c.js
- 1. a.min.js
- 2. b.min.js
- 3. c.min.js
- min: {
- dist: {
- src: 'js/**/*.js',
- dest: 'js/min/xxx.min.js'
- }
- }
- uglify: {
- build: {
- files: [{
- expand: true,
- src: '**/*.js',
- dest: 'build/scripts',
- cwd: 'app/scripts'
- }]
- }
- }
- uglify: {
- dist: {
- files: {
- 'dist/main.js': 'src/main.js',
- 'dist/widget.js': 'src/widget.js'
- }
- }
- }
- min: {
- files: grunt.file.expandMapping(['path/*.js', 'path2/*.js'], 'destination/', {
- rename: function(destBase, destPath) {
- return destBase+destPath.replace('.js', '.min.js');
- }
- })
- }
- min: {
- min_a: {
- src: 'a.js',
- dest: 'a.min.js'
- },
- min_b: {
- src: 'b.js',
- dest: 'b.min.js'
- },
- min_c: {
- src: 'c.js',
- dest: 'c.min.js'
- }
- module.exports = function(grunt) {
- // Project configuration.
- grunt.initConfig({
- pkg: grunt.file.readJSON('package.json'),
- uglify: {
- build: {
- files: [{
- expand: true,
- src: '**/*.js',
- dest: 'build/scripts',
- cwd: 'public_html/app',
- ext: '.min.js'
- }]
- }
- }
- });
- // Load the plugin that provides the "uglify" task.
- grunt.loadNpmTasks('grunt-contrib-uglify');
- // Default task(s).
- grunt.registerTask('default', ['uglify']);
- };
- copy: {
- dist: {
- src: 'a.js',
- dest: 'a.min.js'
- }
- },
- minidirect: {
- all: 'js/min/*.min.js'
- }
- var filesA = 'a.js', filesB = 'b.js', filesC = 'c.js';
- ...
- min: {
- min_a: {
- src: filesA,
- dest: 'a.min.js'
- },
- min_b: {
- src: filesB,
- dest: 'b.min.js'
- },
- min_c: {
- src: filesC,
- dest: 'c.min.js'
- }
- watch: {
- min_a: {
- files: filesA,
- tasks: ['min:min_a']
- },
- min_b: {
- files: filesB,
- tasks: ['min:min_b']
- },
- min_c: {
- files: filesC,
- tasks: ['min:min_c']
- }
- }
- uglify: {
- dist: {
- files: [{
- expand: true,
- src: '**/*.js',
- dest: 'destdir',
- cwd: 'srcdir',
- rename: function(dest, src) { return dest + '/' + src.replace('.js', '.min.js'); }
- }]
- }
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement