1.0.2 • Published 8 years ago

browserify-loader2 v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

browserify-loader

A CommonJS Loader for browserify workflow.

What is browserify-loader

browserify-loader is another CommonJS loader for browserify workflow. With BL, You don’t need any tools like watchify, browserify-middleware to auto build and serve bundle *js in development env.

browserify-loader is similar with requirejs, but:

  • Follow module loading algorithm
  • get rid of wrapper code like define()
  • be compatible all npm package and all bower components witch support CommonJS. like underscore, backbone, jQuery and so on.

Getting started

Install

Download browserify-loader with npm:

$ npm install browserify-loader2

Put browserify-loader.min.js in your page:

<!DOCTYPE html>
<html>
<head>
  <title></title>
</head>
<body>
    <script main="./app.js" src="node_modules/browserify-loader2/out/browserify-loader.min.js"></script>
</body>
</html>

Then, browserify-loader will start to run for main file in your package.json file.

Options

  • main: the main entrance script like app.js in node app.js
  • defineName: The name of the define function. Not supported yet.
  • forceExt: Force loading files with valid extensions only, ignore files with invalid extenstion. Not supported yet.
  • forceDir: Force path which ends with / to be a directory module. Not supported yet.

Example

Look into example/index.html.

Tests

The module loader has test cases written in Qunit, open test/index.html.