Skip to content
forked from codespeaks/modulr

A CommonJS module implementation in Ruby for client-side JavaScript

License

Notifications You must be signed in to change notification settings

lcameroon/modulr

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

modulr

Description

modulr is a CommonJS module implementation in Ruby for client-side JavaScript.

Install

$ [sudo] gem install modulr

Usage

modulr accepts a singular file as input (the program) on which is does static analysis to recursively resolve its dependencies.

The program, its dependencies and a small, namespaced JavaScript library are concatenated into a single js file. This improves load times by minimizing HTTP requests.

The bundled JavaScript library provides each module with the necessary require function and exports and module free variables.

modulr is available as a Ruby library or as a command-line utility (modulrize).

To process a JavaScript source file, just run:

$ modulrize filename.js > output.js

For a comprehensive list of options:

$ modulrize --help"

Specs

To run the specs, first clone the Git repository then grab the CommonJS specs, included as a Git submodule, by running:

$ git clone git://github.com/codespeaks/modulr.git
$ cd modulr
$ git submodule init
$ git submodule update

Mozilla's SpiderMonkey is required and the js command line executable must be available on the load path (try which js).

You can run all the specs by issuing:

$ rake spec

Alternatively, a list of comma-separated specs can be specified through the SPECS environment variable (see vendor/commonjs/tests/modules/1.0) for a comprehensive list of available specs).

$ rake spec SPECS=absolute,transitive

About

A CommonJS module implementation in Ruby for client-side JavaScript

Resources

License

Stars

Watchers

Forks

Packages

No packages published