superjoin
Brings node.js like module loader support to the web
Last updated 2 years ago by andifeind .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install superjoin 
SYNC missed versions from official npm registry.

Superjoin

Superjoin is a module loader for the web. It brings Node.js like require support to the front-end. It uses npm or bower as package storage and gives you the possibility to use your own local packages.

Installation

Superjoin is available on NPM the packagemanager for Node.js

The command to install it global:

npm install -g superjoin

If you prefer a local installation then remove the -g flag from install command.

Requirements

Node.js >= 4.2.0

Usage of Superjoin:

Superjoin can be configured with a superjoin.json file placed everywhere in your project. A minimum configuration looks like:

{
    "name": "myproject",
    "main": "index.js",
    "files": [
        "hello.js"
    ]
}

Superjoin parse all modules an includes submodules automatically. You mustn't add all your requirements in the superjoin file.

Run the build job

$ superjoin -o build.js

Run this command from the same folder where your superjoin.json file is. That command will create a bundle with all modules and their requirements.

Include the build file

Place this simple html snippet in the head of your index.html

<script type="text/javascript" src="build.js"></script>

Inside your code

//Load local modules
var myModule = require('./modules/myModule.js');

//Load from node_modules or bower_components
var $ = require('jquery');

The difference of local and npm/bower modules is the leading ./ or ../. If a module name starts with ./ or ../ it will be loaded as a local file. All other modules are being processed as npm or bower modules.

The loading order of npm/bower modules is the following:

  1. Tries to load it from bower_components. If no bower_module folder is found, tries to load it from a bower_components folder in the parent directory, until the root directory.

  2. Tries to load it from node_modules. If no bower_module folder is found, tries to load it from a node_modules folder in the parent directory, until the root directory.

  3. Tries to resolve the path as a local module.

  4. Throws a module not found error.

Read the full documentation

Superjoin as a plugin

Looking for plugins?

Superjoin plugin for Grunt.

Current Tags

  • 0.5.1                                ...           latest (2 years ago)

10 Versions

  • 0.5.1                                ...           2 years ago
  • 0.5.0                                ...           4 years ago
  • 0.4.0                                ...           4 years ago
  • 0.3.2                                ...           4 years ago
  • 0.3.1                                ...           4 years ago
  • 0.3.0                                ...           4 years ago
  • 0.2.0                                ...           5 years ago
  • 0.1.1                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
  • 0.0.1                                ...           5 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (8)
Dev Dependencies (9)

Copyright 2014 - 2016 © taobao.org |