README
ninjs-rjs
requirejs build utils
Overview
This module includes common requirejs utility methods that fall into the following groupings:
- Compiling/Optimizing/Obfuscating js
- Dynamic UI Generators
We tried to keep it as tiny as possible with as few dependencies as possible.
{
"dependencies": { "ninjs-lodash": "^0.1.56", "requirejs" : "^2.3.2" },
"bundleDependencies": [],
"peerDependencies": {},
"devDependencies": {},
"optionalDependencies": {}
}
Setup
Install
Install the module locally and add to ./package.json dependencies
npm install --save ninjs-rjs
Import
const _ = require('ninjs-lodash')
const rjs = require('ninjs-rjs')
$ettings
Override/Add your own $ettings
- Create a ./.ninjs/settings.js(json) file within a module cwd that exports an object
- You can now access that object (and nested props) via _.$()
- internally uses _.get(settings, 'keypath'))
- *Be careful not to override _.$() default settings
_.$('rjs.options.paths') // get
_.$('rjs.options.paths', true) // set
Default Settings
{
"paths": {
"code": "F:",
"dev": "Y:",
"prod": "Z:"
},
"rjs": {
"optimize_options": ["none", "uglify"],
"file_suffix_map": { "none": "", "uglify": "min" },
"result_key_order": ['name', 'src', 'results', 'files', 'paths', 'shim'],
"options": {
"enabled": true,
"baseUrl": "js",
"name": "main",
"out": "public/js/scripts.js",
"optimize": "none",
"paths": {
"text": CDN_REQ_TEXT,
"jquery": IGNORE,
"underscore": IGNORE,
"moment": IGNORE,
"backbone": IGNORE,
"ba": IGNORE,
"jqueryactual": IGNORE,
"jqappear": IGNORE,
"jquerycookie": IGNORE,
"jqueryui": IGNORE,
"jquery.ui.widget": IGNORE,
"jqueryiframetransport": IGNORE,
"jqueryfileupload": IGNORE,
"ace": IGNORE,
"iscroll": IGNORE,
"spin": IGNORE,
"sio": IGNORE,
"spectrum": IGNORE,
"twemoji": IGNORE,
"fblib": IGNORE
},
"shim": {
"jquery": { "exports": "