0.1.2 • Published 8 years ago

cjs2iife v0.1.2

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

cjs2iife

Build Status Dependencies devDependency Status NPM Version Coverage Status

Convert all commonjs files to one immediately-invoked-function-expression file

Background

When you wanna develop a library, but you don't need to support AMD or CommonJS or CMD or UMD in production environment. Finnaly you only need a combined iife file to deploy. Howerver, the library code base is not small, you still need a module style to manage your source code to avoid your code in mess. This tool is for it, you can using CommonJS module style to write your code, and use this tool to pack to one iife file.

Usage

Install

npm install cjs2iife

Example

var cjs2iife = require('cjs2iife');
var result = cjs2iife({
    dir: 'src',     // the source base dir
    main: 'index',  // the entry module to pack
    compress: true, // enable the compress option, optional, default not compress
    output: 'dist/combine.min.js', // the output file path, optional
    exports: 'myGlobalObj' // the variable name to export to window object, optional
});