global-splitter
Splits a JavaScript file with multiple expression statements under one global into multiple files with CommonJS headers
Example
Given a file like
FirstFileOf { var something = 1: 3 2: 4 5: 9 ;}; AnotherFileOfOthers = {}; ThirdFileOf { var ff = $;};
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 { var something = 1: 3 2: 4 5: 9 ;}
output/One.js
'use strict'; var $ = ; module { var ff = $;}
output/Others.js
'use strict'; moduleexports = {}
Options
- Can include footer file
includes/footer.hbs
which supports the following values:fileName
of the output file