Skip to content

Commit

Permalink
build: minimizer initial research using r.js
Browse files Browse the repository at this point in the history
  • Loading branch information
abose committed Jun 10, 2022
1 parent 326add8 commit f1570af
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 1 deletion.
20 changes: 20 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"lodash": "^4.17.21",
"merge-stream": "^2.0.0",
"readable-stream": "^3.6.0",
"requirejs": "^2.3.6",
"through2": "^4.0.2"
},
"scripts": {
Expand All @@ -52,7 +53,8 @@
"release:prod": "gulp releaseProd",
"serve": "http-server . -p 8000 -c-1",
"serveExternal": "http-server . -p 8000 -a 0.0.0.0 --log-ip true -c-1",
"createJSDocs": "gulp createJSDocs && git add docs"
"createJSDocs": "gulp createJSDocs && git add docs",
"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"
},
"licenses": [
{
Expand Down
40 changes: 40 additions & 0 deletions require.min.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// this is WIP
// References:
// https://stackoverflow.com/questions/14337970/minifying-requirejs-javascript-codebase-to-a-single-file
// https://github.com/requirejs/r.js
// https://github.com/requirejs/r.js/blob/master/build/example.build.js
// https://requirejs.org/docs/optimization.html
// https://github.com/brackets-cont/brackets/blob/master/Gruntfile.js



({
// `name` and `out` is set by grunt-usemin
baseUrl: 'src',
optimize: 'uglify2',
// brackets.js should not be loaded until after polyfills defined in "utils/Compatibility"
// so explicitly include it in main.js
include: ["utils/Compatibility", "brackets"],
// TODO: Figure out how to make sourcemaps work with grunt-usemin
// https://github.com/yeoman/grunt-usemin/issues/30
generateSourceMaps: true,
useSourceUrl: true,
// required to support SourceMaps
// http://requirejs.org/docs/errors.html#sourcemapcomments
preserveLicenseComments: false,
useStrict: true,
// Disable closure, we want define/require to be globals
wrap: false,
paths: {
"text": "thirdparty/text/text",
"i18n": "thirdparty/i18n/i18n",
// The file system implementation. Change this value to use different
// implementations (e.g. cloud-based storage).
"fileSystemImpl": "filesystem/impls/appshell/AppshellFileSystem",
"preact-compat": "thirdparty/preact-compat/preact-compat.min",
"thirdparty/preact": "thirdparty/preact/preact"
},
uglify2: {}, // https://github.com/mishoo/UglifyJS2
waitSeconds: 60,
out: "src/brackets-min.js"
})

0 comments on commit f1570af

Please sign in to comment.