tiny-rjs

Tiny loader for RequireJS

not used anymore, try oh-my-deps
Last updated 5 years ago by pateketrueke .
MIT · Original npm · Tarball · package.json
$ cnpm install tiny-rjs 
SYNC missed versions from official npm registry.

tiny-rjs.

Build Status NPM version

Q: Yet Another RequireJS/AMD Implementation?

A: Nope.

We want to do this:

rjs.define('/vendor/jquery/dist/jquery.js', 'jquery');
rjs.define('/vendor/moment/moment.js', 'moment');
rjs.define('/vendor/moment/locale/es.js', 'moment/locale/es');

and then:

rjs.require ['jquery', 'moment', 'moment/locale/es'], ->
  # $ and moment are globals
  $('.date-decorator').each ->
    $el = $(this)
    $el.text moment($el.data('date'), 'YYYYMMDD').fromNow()

AMD Support

This script loader has no support for AMD.

However you can still load simple define() functions:

# scripts/event-bus.coffee
define 'event-bus', ->
  EE2 = require 'eventemitter2'
  new EE2

Later you can require this chunk of code:

rjs.require ['event-bus'], (e) ->
  e.on 'some-event', ->

The main advantage of this is encapsulating code rather that organizing your code application.

Consider the following constraints:

  • TinyRJS was designed for working with existing libraries in the Bower registry.
  • Most of them are namespaced or their globals are not enough harmful.
  • Calling rjs.require() will load all scripts in sequence.

Issues

Under development. ∞

Current Tags

  • 0.1.0                                ...           latest (5 years ago)

3 Versions

  • 0.1.0 [deprecated]           ...           5 years ago
  • 0.0.3 [deprecated]           ...           5 years ago
  • 0.0.2 [deprecated]           ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |