From: Jörn Zaefferer Date: Tue, 6 Mar 2012 18:30:20 +0000 (+0100) Subject: Build/grunt: Custom banners for the various minified files X-Git-Tag: 1.9.0m8~213 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3f1750330070de1c8a48ab42c4f4bb90e0372e02;p=jquery-ui.git Build/grunt: Custom banners for the various minified files --- diff --git a/grunt.js b/grunt.js index 2ee625f51..fe1e92bc8 100644 --- a/grunt.js +++ b/grunt.js @@ -10,27 +10,38 @@ var rawList = allFiles.map(function(file) { }); var minify = { - 'dist/ui/minified/jquery-ui.min.js': ['', 'dist/ui/jquery-ui.js'], + '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'] + '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: { - banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + +var allI18nFiles = file.expand('ui/i18n/*.js'); +allI18nFiles.forEach(minFile); +var i18nfiles = allI18nFiles.map(function(file) { + return file.substring(8); +}); + +function createBanner(files) { + return '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + '<%= template.today("isoDate") %>\n' + '<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' + // TODO makes this banner only useful for the min-all task below... - '* Includes: ' + rawList.join(', ') + '\n' + + (files ? '* Includes: ' + files.join(', ') + '\n' : '') + '* Copyright (c) <%= template.today("yyyy") %> <%= pkg.author.name %>;' + - ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */' + ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'; +} + +config.init({ + pkg: '', + meta: { + banner: createBanner(), + bannerAll: createBanner(rawList), + bannerI18n: createBanner(i18nfiles) }, concat: { 'dist/ui/jquery-ui.js': allFiles,