module.exports = function(grunt) { // Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), concat: { options: { process: function(src, filepath) { var unwraps = ['/js/']; var shouldWrap = true; for (var i = 0; i < unwraps.length; ++i) { if (filepath.indexOf(unwraps[i]) >= 0) { shouldWrap = false; break; } } if (shouldWrap) { return '// Source: ' + filepath + '\n' + '(function() {\n' + src + '\n})();\n'; } else { return '// Source: ' + filepath + '\n' + src + '\n\n'; } }, }, build: { src: ['../static/lib/**/*.js', '../static/js/*.js', '!../static/lib/jquery.overscroll.min.js'], dest: '../static/dist/<%= pkg.name %>.js' } }, cssmin: { '../static/dist/<%= pkg.name %>.css': ['../static/lib/**/*.css', '../static/css/*.css'] }, uglify: { options: { mangle: false }, js_min: { files: { '../static/dist/<%= pkg.name %>.min.js': ['../static/dist/<%= pkg.name %>.js'] } } } }); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-cssmin'); // Default task(s). grunt.registerTask('default', ['concat', 'cssmin', 'uglify']); };