demodule
bundle javascript files into one for the browser
Last updated 6 years ago by jaekwon .
(K) · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install demodule 
SYNC missed versions from official npm registry.

Demodule - CommonJS for the browser!

A simple tool to package javascript files into one using CommonJS module specification.
If you want to structure your browser client code using CommonJS (like NodeJS's 'require()'), this is for you.

  • Explicitly define which files to include
  • Recursive require() support
  • Minimization

Example

This is a sample build script using Demodule.
You can see the full example in the example folder.

var demodule = require("demodule");
var fs = require("fs");

var dependencies = [
    // a single file
    {name:"app", path:"./app.js"},

    // a library from NPM
    {name:"underscore", path:"./node_modules/underscore/underscore.js"},

    // a whole directory, recursively.
    {name:"lib", path:"./lib"},

    // another whole directory
    {name:"foo", path:"./foo"},
];

var entry = 'require("app").run();';

var code = demodule(dependencies, entry, {minify: false, debug:true});

var err = fs.writeFileSync("build/app.js", code);

if (err) { throw(err); }

Installation

Requires NodeJS.

See the example app for usage.

Current Tags

  • 0.0.8                                ...           latest (6 years ago)

3 Versions

  • 0.0.8                                ...           6 years ago
  • 0.0.2                                ...           7 years ago
  • 0.0.1                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 2
Dependencies (2)
Dev Dependencies (0)
None
Dependents (2)

Copyright 2014 - 2017 © taobao.org |