From: Jörn Zaefferer Date: Tue, 6 Mar 2012 17:52:50 +0000 (+0100) Subject: Build/grunt: Extend concat and min tasks to include all the files the current build... X-Git-Tag: 1.9.0m8~214 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=953c49ff9d2597c96ec7e4c398288e7b6ef97b8f;p=jquery-ui.git Build/grunt: Extend concat and min tasks to include all the files the current build includes. Headers aren't correct yet. --- diff --git a/grunt.js b/grunt.js index ab8d57f31..2ee625f51 100644 --- a/grunt.js +++ b/grunt.js @@ -8,6 +8,19 @@ var allFiles = coreFiles.map(function(file) { var rawList = allFiles.map(function(file) { return file.substring(3); }); + +var minify = { + 'dist/ui/minified/jquery-ui.min.js': ['', 'dist/ui/jquery-ui.js'], + // TODO adjust banner to get access to the list of included files + 'dist/ui/minified/i18n/jquery-ui-i18n.min.js': ['', 'dist/ui/i18n/jquery-ui-i18n.js'] +}; +function minFile(file) { + // TODO adjust banner to get access to the list of included files + minify['dist/' + file.replace(/\.js$/, '.min.js').replace(/ui\//, 'ui/minified/')] = ['', file]; +} +allFiles.forEach(minFile); +file.expand('ui/i18n/*.js').forEach(minFile); + config.init({ pkg: '', meta: { @@ -20,11 +33,10 @@ config.init({ ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */' }, concat: { - 'dist/jquery-ui.js': allFiles - }, - min: { - 'dist/jquery-ui.min.js': ['', 'dist/jquery-ui.js'] + 'dist/ui/jquery-ui.js': allFiles, + 'dist/ui/i18n/jquery-ui-i18n.js': 'ui/i18n/*.js' }, + min: minify, zip: { dist: { src: [ @@ -80,11 +92,12 @@ task.registerBasicTask('zip', 'Create a zip file for release', function(data) { var zip = new AdmZip(); files.forEach(function(file) { log.verbose.writeln('Zipping ' + file); - zip.addFile(file, fs.readFileSync(file)); + // rewrite file names from dist folder (created by build), drop the /dist part + zip.addFile(file.replace(/^dist/, ''), fs.readFileSync(file)); }); zip.writeZip(data.dest); log.writeln("Wrote " + files.length + " files to " + data.dest); }); task.registerTask('default', 'lint qunit'); -task.registerTask('release', 'default concat min zip'); +task.registerTask('release', 'concat min zip');