Skip to content

Commit b5b43b8

Browse files
committed
Split grunt copy task into copy and uglify to minify JS files
1 parent cab8d17 commit b5b43b8

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

Gruntfile.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,42 @@ module.exports = function (grunt) {
4343
}]
4444
}
4545
},
46+
uglify: {
47+
options: {
48+
mangle: false,
49+
compress: false
50+
},
51+
dist: {
52+
files: [{
53+
expand: true,
54+
cwd: 'src/',
55+
src: [
56+
/* static files */
57+
'nls/{,*/}*.js',
58+
'xorigin.js',
59+
'dependencies.js',
60+
'thirdparty/requirejs/require.js',
61+
'LiveDevelopment/MultiBrowserImpl/transports/**/*.js',
62+
'LiveDevelopment/MultiBrowserImpl/launchers/**/*.js',
63+
64+
/* extensions and CodeMirror modes */
65+
'!extensions/default/*/unittests.js',
66+
'extensions/default/*/**/*.js',
67+
'!**/unittest-files/**',
68+
'!extensions/default/JavaScriptCodeHints/thirdparty/*/test/**/*',
69+
'!extensions/default/**/node_modules/**/*',
70+
'thirdparty/CodeMirror2/addon/{,*/}*.js',
71+
'thirdparty/CodeMirror2/keymap/{,*/}*.js',
72+
'thirdparty/CodeMirror2/lib/{,*/}*.js',
73+
'thirdparty/CodeMirror2/mode/{,*/}*.js',
74+
'thirdparty/CodeMirror2/theme/{,*/}*.js',
75+
'thirdparty/i18n/*.js',
76+
'thirdparty/text/*.js'
77+
],
78+
dest: 'dist/'
79+
}]
80+
}
81+
},
4682
copy: {
4783
dist: {
4884
files: [
@@ -345,6 +381,9 @@ module.exports = function (grunt) {
345381
'build-config'
346382
]);
347383

384+
// task: build dist/ for browser
385+
grunt.registerTask('build-browser', ['build', 'uglify']);
386+
348387
// Default task.
349388
grunt.registerTask('default', ['test']);
350389
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"grunt-contrib-htmlmin": "0.1.3",
3030
"grunt-contrib-less": "0.8.2",
3131
"grunt-contrib-requirejs": "0.4.1",
32-
"grunt-contrib-uglify": "0.2.0",
32+
"grunt-contrib-uglify": "0.8.0",
3333
"grunt-contrib-concat": "0.3.0",
3434
"grunt-targethtml": "0.2.6",
3535
"grunt-usemin": "0.1.11",

0 commit comments

Comments
 (0)