Recycled environment & assets for making browser modules.
npm install --save-dev browser-module-env
After installing:
flyfile.js in your root directory with the following:process.env.OUTNAME = 'MyModule'; // module's name
process.env.OUTFILE = 'my-module.js'; // built file name
module.exports = require('browser-module-env/flyfile.js');
This will expose this module's pre-configured command scripts.
package.json file within "scripts":"scripts": {
"setup": "fly setup",
"build": "fly build",
"docs": "fly docs",
"release": "fly release",
"start": "fly release serve",
"watch": "fly watch"
}
This will let you execute commands with npm.
For example,
npm run watch.
package.json file:"fly": {
"pkg": "node_modules/browser-module-env"
}
docs directory.npm run setup
If this works, you're ready to roll! :tada:
Each command takes the form: npm run {command}.
Copies static demo assets (bg.jpg, chart.css, demo.css, demo.js) to your docs directory.
Builds the UMD module. Output is sent to build.
Creates a browserify bundle, using docs/app.js as its entry file. Output is sent to docs/bundle.js.
Runs build and docs then minifies build/*.js and docs/bundle.js using Uglify JS.
Note: Your minified module will be saved with a
.min.jsextension in thebuilddirectory.
Starts a local server on port 3000 using BrowserSync.
Runs serve but will auto-compile & auto-reload the server after any file changes within docs directory.
MIT © Luke Edwards