|
4 | 4 | * license that can be found in the LICENSE file.
|
5 | 5 | */
|
6 | 6 | module.exports = function(grunt) {
|
| 7 | + var temporary = require('temporary'); |
| 8 | + var tmp = new temporary.File(); |
7 | 9 |
|
8 | 10 | // recursive module builder
|
9 | 11 | var path = require('path');
|
@@ -43,7 +45,7 @@ module.exports = function(grunt) {
|
43 | 45 | nonull: true
|
44 | 46 | },
|
45 | 47 | files: {
|
46 |
| - 'platform.concat.js': readManifest('build.json') |
| 48 | + 'platform.concat.js': readManifest('build.json', [tmp.path]) |
47 | 49 | }
|
48 | 50 | }
|
49 | 51 | },
|
@@ -107,7 +109,21 @@ module.exports = function(grunt) {
|
107 | 109 | grunt.file.write(dest, JSON.stringify(destMap));
|
108 | 110 | });
|
109 | 111 |
|
110 |
| - grunt.registerTask('default', ['concat_sourcemap', 'uglify', 'sourcemap_copy:platform.concat.js.map:platform.min.js.map']); |
| 112 | + // Workaround for banner + sourceMap + uglify: https://github.com/gruntjs/grunt-contrib-uglify/issues/22 |
| 113 | + grunt.registerTask('gen_license', function() { |
| 114 | + var banner = [ |
| 115 | + '/* @license', |
| 116 | + grunt.file.read('LICENSE'), |
| 117 | + '*/' |
| 118 | + ].join(grunt.util.linefeed); |
| 119 | + grunt.file.write(tmp.path, banner); |
| 120 | + }); |
| 121 | + |
| 122 | + grunt.registerTask('clean_license', function() { |
| 123 | + tmp.unlinkSync(); |
| 124 | + }); |
| 125 | + |
| 126 | + grunt.registerTask('default', ['gen_license', 'concat_sourcemap', 'uglify', 'sourcemap_copy:platform.concat.js.map:platform.min.js.map', 'clean_license']); |
111 | 127 | grunt.registerTask('docs', ['yuidoc']);
|
112 | 128 | grunt.registerTask('test', ['override-chrome-launcher', 'karma:platform']);
|
113 | 129 | grunt.registerTask('test-buildbot', ['override-chrome-launcher', 'karma:buildbot']);
|
|
0 commit comments