Skip to content

Instantly share code, notes, and snippets.

@voduytuan
Created April 24, 2016 02:33
Show Gist options
  • Save voduytuan/ed9e2f410ae5e9bde2b342422eb40273 to your computer and use it in GitHub Desktop.
Save voduytuan/ed9e2f410ae5e9bde2b342422eb40273 to your computer and use it in GitHub Desktop.
Teamcrop Front-end Requirejs Optimizer build file
({
baseUrl: 'js/',
out: 'js/main-built.js',
/* DO NOT CHANGE THIS LINE (IT WILL BE USED BY GULP TASK TO GENERATE ALL MODULES FOR REQUREIJS) */
include: ['main', 'requireLib'],
/* DO NOT CHANGE ABOVE LINE */
//optimizeAllPluginResources: true,
fileExclusionRegExp: /^((r|build)\.js)$/,
keepBuildDir: true,
optimize: "uglify",
removeCombined: true,
paths: {
underscore: 'libs/underscore/underscore',
backbone: 'libs/backbone/backbone',
backbonereactcomponent: 'libs/backbone/backbonereactcomponent',
react: 'libs/react/react-with-addon-dev',
JSXTransformer: 'JSXTransformer-modified-for-requirejxs',
pref: 'registry/pref',
querystring: 'registry/querystring',
localforage: 'registry/localforage',
initquerystring: 'registry/initquerystring',
setting: 'registry/setting',
helper: 'registry/helper',
license: 'registry/license',
role: 'registry/role',
companyresource: 'registry/companyresource',
socket: 'registry/socket',
registrystore: 'registry/registrystore',
companysetting: 'registry/companysetting',
phonegap: 'registry/phonegap',
requireLib: 'require'
},
onBuildWrite: function (moduleName, path, singleContents) {
return singleContents.replace(/jsx!/g, ''); //remove jsx! text in all js file to prevent using jsx compiler
},
onModuleBundleComplete: function (data) {
var fs = nodeRequire("fs");
for (var i = 0; i < data.included.length; i++) {
var modulefile = data.included[i];
//var fs = require('fs');
fs.unlinkSync(modulefile);
}
},
noBuildTxt: true,
normalizeDirDefines: "skip"
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment