0.0.35 • Published 9 years ago

ninjs-rjs v0.0.35

Weekly downloads
4
License
AGPL-1.0
Repository
github
Last release
9 years ago

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": "$" },
        "underscore": { "exports": "_" },
        "lodash": { "exports": "_" },
        "backbone": { "exports": "Backbone", "deps": ["underscore", "jquery"] },
        "ba": { "deps": ["underscore", "backbone"] },
        "jqueryui": { "deps": ["jquery"] },
        "jquerycookie": { "deps": ["jquery"] },
        "jqueryactual": { "deps": ["jquery"] },
        "jqappear": { "deps": ["jquery"] },
        "jqhashchange": { "deps": ["jquery"] },
        "jqeasytabs": { "deps": ["jquery", "jqhashchange"] },
        "jqueryiframetransport": { "deps": ["jquery"] },
        "jqueryfileupload": { "deps": ["jquery", "jqueryiframetransport"] },
        "ace": { "exports": "ace" },
        "spectrum": { "deps": ["jquery"] },
        "twemoji": { "exports": "twemoji" }
      }
    },
    "client_paths": {
      "text": CDN_URL + "/js/require/text.min",
      "jquery": CDN_URL + "/js/jquery/jquery.slim.min",
      "underscore": CDN_URL + "/js/lodash/lodash.slim.min",
      "moment": CDN_URL + "/js/moment/moment.min",
      "backbone": CDN_URL + "/js/backbone/backbone.min",
      "ba": CDN_URL + "/js/backbone/ba.min",

      "jqueryactual": CDN_URL + "/jquery.actual.min",
      "jqappear": CDN_URL + "/jquery.appear.min",
      "jquerycookie": CDN_URL + "/jquery.cookie.min",
      "jqueryui": CDN_URL + "/jquery.ui.min",
      "jquery.ui.widget": CDN_URL + "/jquery.ui.widget.min",
      "jqueryiframetransport": CDN_URL + "/jquery.iframe-transport.min",
      "jqueryfileupload": CDN_URL + "/jquery.fileupload.min",

      "ace": CDN_URL + "/ace",
      "iscroll": CDN_URL + "/iscroll.min",
      "spin": CDN_URL + "/spin.min",
      "sio": CDN_URL + "/sio.min",
      "spectrum": CDN_URL + "/spectrum.min",
      "twemoji": CDN_URL + "/twemoji.min",
      "fblib": "//connect.facebook.net/en_US/all",

      "mans": CDN_URL + "/snapp/mans",
      "models": CDN_URL + "/snapp/models",
      "node": CDN_URL + "/snapp/node",
      "plat": CDN_URL + "/snapp/plat",
      "rest": CDN_URL + "/snapp/rest",
      "ui": CDN_URL + "/snapp/ui",
      "mixins": CDN_URL + "/snapp/mixins"
    }
  }
}

Compiling/Optimizing .js

rjs.render(options, callback)

UI Generation

Creates UI Kits on the fly


 

0.0.35

9 years ago

0.0.34

9 years ago

0.0.33

9 years ago

0.0.32

10 years ago

0.0.28

10 years ago

0.0.27

10 years ago

0.0.26

10 years ago

0.0.25

10 years ago

0.0.24

10 years ago

0.0.23

10 years ago

0.0.22

10 years ago

0.0.21

10 years ago

0.0.20

10 years ago

0.0.19

10 years ago

0.0.18

10 years ago

0.0.17

10 years ago

0.0.16

10 years ago

0.0.15

10 years ago

0.0.14

10 years ago

0.0.13

10 years ago

0.0.12

10 years ago

0.0.11

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago