
If you want to include require.js with the main.js source, you can use this kind of command: node. Then, you can change the main-built.js file name to just main.js so the HTML page will load the optimized version of the file. Change the out= option to any directory you like, that has a copy of your source. Normally you would save them to a copy of your project, but to make this example easier it is saved with the source.

Normally you should not save optimized files with your pristine project source. This will create a file called appdirectory/scripts/main-built.js that will include the contents of main.js, one.js, two.js and three.js. /r.js -o name=main out=main-built.js baseUrl=. Use the above example setup, if you just wanted to optimize main.js, you could use this command, from inside the appdirectory/scripts directory: node. In other words, the mainConfigFile configuration has the lowest priority. The precedence for config: command line, build profile, mainConfigFile. Or: define(, function (a, b) ) found in that file will be parsed out and used as part of the configuration options passed to the optimizer: mainConfigFile: 'path/to/main.js'
#HTML OPTIMIZER SELECT OPTIONS MODS#
So, it will not find modules that are loaded via a variable name: var mods = someCondition ? : īut 'a' and 'b' will be included if specified like so: require() The optimizer will only combine modules that are specified in arrays of string literals that are passed to top-level require and define calls, or the require('name') string literal calls in a simplified CommonJS wrapping. The optimizer is part of the r.js adapter for Node and Nashorn, and it is designed to be run as part of a build or packaging step after you are done with development and are ready to deploy the code for your users. Optimizes CSS by inlining CSS files referenced by and removing comments.Combines related scripts together into build layers and minifies them via UglifyJS (the default) or Closure Compiler (an option when using Java).RequireJS has an optimization tool that does the following

empty: paths for network/CDN resources § 7.Shallow exclusions for fast development § 6.
