Skip to content

Instantly share code, notes, and snippets.

@sjungling
Created August 14, 2013 20:14
Show Gist options
  • Save sjungling/6235123 to your computer and use it in GitHub Desktop.
Save sjungling/6235123 to your computer and use it in GitHub Desktop.
recursive in-place Uglify
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