0.1.0 • Published 10 years ago

global-splitter v0.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

global-splitter

Splits a JavaScript file with multiple expression statements under one global into multiple files with CommonJS headers

Example

Given a file like

First.File.Of.Many = function () {
    var something = {
        1: 3, 2: 4, 5: 9
    };
};

Another.File.Of.Others = {};

Third.File.Of.One = function () {
    var ff = $.find("123123.2");
};

Install via npm install global-splitter

Then run ./node_modules/.bin/global-splitter test/testdata.js

This will create three files

output/Many.js

'use strict';

module.exports = function () {
    var something = {
            1: 3,
            2: 4,
            5: 9
        };
}

output/One.js

'use strict';

var $ = require('jquery');

module.exports = function () {
    var ff = $.find('123123.2');
}

output/Others.js

'use strict';

module.exports = {}

Options

  • Can include footer file includes/footer.hbs which supports the following values:
    • fileName of the output file
0.1.0

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago