Created
August 14, 2013 20:14
-
-
Save sjungling/6235123 to your computer and use it in GitHub Desktop.
recursive in-place Uglify
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
var uglify = { | |
options: { | |
files: function(srcDir) { | |
var filesAry = []; | |
var results = {}; | |
filesAry.push(srcDir); | |
filesAry = grunt.file.expand(filesAry); | |
filesAry.forEach(function(file) { | |
results[file] = [file]; | |
}); | |
return results; | |
}, | |
} | |
}; | |
// Project configuration. | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
uglify: { | |
options: { | |
mangle: { | |
except: ['Zepto', 'jQuery', 'Backbone'] | |
}, | |
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd") %> */', | |
}, | |
my_target: { | |
files: uglify.options.files('scripts/**/*.js') | |
} | |
} | |
}); | |
grunt.loadNpmTasks('grunt-contrib-uglify'); | |
// Default task(s). | |
grunt.registerTask('default', ['uglify']); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment