Skip to content

PsichiX/bundler.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bundler.js

Tool to produce application bundles

bundler.js is great and easy to use tool to produce application bundles.

NPM

Installation

$ npm install bundler.js

If you want to use bundler.js from terminal, you should install it globally:

$ npm install -g bundler.js

API Usage Examples

var bundler = require('bundler.js'),
    actions = {
        flushAssetsList: function(file, config, info, bundleDirs, bundlerActions){
            fs.writeFileSync(bundleDirs.destination + info.pathTo, JSON.stringify({assets: list}));
            list = [];
            console.log('FLUSH ASSETS LIST: ' + bundleDirs.destination + info.pathTo);
            console.log();
        },
        listAsset: function(file, config, info, bundleDirs, bundlerActions){
            list.push(info);
        },
        something: function(file, config, info, bundleDirs, bundlerActions){
            console.log('DO SOMETHING');
            console.log();
        }
    };

bundler.bundle('bundle.json', actions, 'debug');

Commandline Usage Examples

Using configuration file:

$ bundle path/to/configuration.json

and specifying mode:

$ bundle path/to/configuration.json mode

Commandline options:

  • [0] path/to/configuration.json - path to configuration JSON file.
  • [1] mode - mode identifier.

Configuration File Example

{
  "verbose": true,
  "source": "src",
  "intermediate": {
    "debug": "intermediate/debug",
    "release": "intermediate/release"
  },
  "destination": {
    "debug": "bin/debug",
    "release": "bin/release"
  },
  "compiler": {
    "debug": {
      "lint": true,
      "minify": false,
      "defines": {
        "DEBUG": true
      }
    },
    "release": {
      "lint": true,
      "minify": true,
      "defines": {
        "RELEASE": true
      }
    }
  },
  "files": [
    "a.png : gfx/a.png @listAsset ? gfx & hq",
    "b.png : gfx/b.png @listAsset ? gfx & !hq",
    "main.js : app.js @compile|something ? (code & html)",
    "assets.json @flushAssetsList"
  ],
  "variants": {
    "debug": [
      "html",
      "code",
      "gfx"
    ],
    "release": [
      "html",
      "code",
      "gfx",
      "hq"
    ]
  }
}

Support

About

Tool to produce application bundles

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published