Skip to content

Commit f1570af

Browse files
committed
build: minimizer initial research using r.js
1 parent 326add8 commit f1570af

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed

package-lock.json

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"lodash": "^4.17.21",
3535
"merge-stream": "^2.0.0",
3636
"readable-stream": "^3.6.0",
37+
"requirejs": "^2.3.6",
3738
"through2": "^4.0.2"
3839
},
3940
"scripts": {
@@ -52,7 +53,8 @@
5253
"release:prod": "gulp releaseProd",
5354
"serve": "http-server . -p 8000 -c-1",
5455
"serveExternal": "http-server . -p 8000 -a 0.0.0.0 --log-ip true -c-1",
55-
"createJSDocs": "gulp createJSDocs && git add docs"
56+
"createJSDocs": "gulp createJSDocs && git add docs",
57+
"minify": "r.js -o require.min.config.js && echo this is untested see https://stackoverflow.com/questions/14337970/minifying-requirejs-javascript-codebase-to-a-single-file"
5658
},
5759
"licenses": [
5860
{

require.min.config.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// this is WIP
2+
// References:
3+
// https://stackoverflow.com/questions/14337970/minifying-requirejs-javascript-codebase-to-a-single-file
4+
// https://github.com/requirejs/r.js
5+
// https://github.com/requirejs/r.js/blob/master/build/example.build.js
6+
// https://requirejs.org/docs/optimization.html
7+
// https://github.com/brackets-cont/brackets/blob/master/Gruntfile.js
8+
9+
10+
11+
({
12+
// `name` and `out` is set by grunt-usemin
13+
baseUrl: 'src',
14+
optimize: 'uglify2',
15+
// brackets.js should not be loaded until after polyfills defined in "utils/Compatibility"
16+
// so explicitly include it in main.js
17+
include: ["utils/Compatibility", "brackets"],
18+
// TODO: Figure out how to make sourcemaps work with grunt-usemin
19+
// https://github.com/yeoman/grunt-usemin/issues/30
20+
generateSourceMaps: true,
21+
useSourceUrl: true,
22+
// required to support SourceMaps
23+
// http://requirejs.org/docs/errors.html#sourcemapcomments
24+
preserveLicenseComments: false,
25+
useStrict: true,
26+
// Disable closure, we want define/require to be globals
27+
wrap: false,
28+
paths: {
29+
"text": "thirdparty/text/text",
30+
"i18n": "thirdparty/i18n/i18n",
31+
// The file system implementation. Change this value to use different
32+
// implementations (e.g. cloud-based storage).
33+
"fileSystemImpl": "filesystem/impls/appshell/AppshellFileSystem",
34+
"preact-compat": "thirdparty/preact-compat/preact-compat.min",
35+
"thirdparty/preact": "thirdparty/preact/preact"
36+
},
37+
uglify2: {}, // https://github.com/mishoo/UglifyJS2
38+
waitSeconds: 60,
39+
out: "src/brackets-min.js"
40+
})

0 commit comments

Comments
 (0)