Skip to content

Commit fe58dd3

Browse files
committed
Split grunt copy task into copy and uglify to minify JS files
1 parent 64d7830 commit fe58dd3

File tree

2 files changed

+52
-2
lines changed

2 files changed

+52
-2
lines changed

Gruntfile.js

Lines changed: 51 additions & 1 deletion
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: [
@@ -64,7 +100,18 @@ module.exports = function (grunt) {
64100
'LiveDevelopment/MultiBrowserImpl/launchers/**'
65101
]
66102
},
67-
103+
/* node domains are not minified and must be copied to dist */
104+
{
105+
expand: true,
106+
dest: 'dist/',
107+
cwd: 'src/',
108+
src: [
109+
'extensibility/node/**',
110+
'!extensibility/node/spec/**',
111+
'filesystem/impls/appshell/node/**',
112+
'!filesystem/impls/appshell/node/spec/**'
113+
]
114+
},
68115
/* extensions and CodeMirror modes */
69116
{
70117
expand: true,
@@ -328,6 +375,9 @@ module.exports = function (grunt) {
328375
'build-config'
329376
]);
330377

378+
// task: build dist/ for browser
379+
grunt.registerTask('build-browser', ['build', 'uglify']);
380+
331381
// Default task.
332382
grunt.registerTask('default', ['test']);
333383
};

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)