0.2.4 • Published 6 years ago
devbundle v0.2.4
devbundle
Bundle and browser test JavaScript modules during development
Installation
npm install devbundle
Usage
- Add an initiate script
// devbundle.js
import devbundle from "devbundle";
devbundle({
context: __dirname,
input: __dirname + "/index.js",
});
- Run initiate script using Node.js
node devbundle.js
- Open the presentation url in your browser (default http://localhost:8080/)
Configs
Required
context
: Path to the main project directory where the module is runninginput
: Path to input script for the bundle (javascript file)
Optional
title
: Title, used in the presented index htmlicon
: Presentation icon, available: app, camera, chart, chat, cloud, cube (default), html, location, music, phone, plane, pointer, shield, shopping, users, windowsinclude
: Static files to include in the html presentationinclude.css
: Array of static css include file pathsinclude.js
: Array of static jsvascript include file pathsport
: Web server porthostname
: Web server hostname
Extended example
import devbundle from "devbundle";
devbundle({
context: __dirname,
input: __dirname + "/index.js",
title: "Development test"
include: {
css: [
__dirname + "/styles.css"
],
js: [
__dirname + "/scripts.js"
]
},
port: 8081,
hostname: "localhost"
});
What it does
- Builds the input files with all dependencies into a single bundle (using Webpack)
- Including ES6 to ES3 transpiling
- Including JSX compilation (React)
- Including SASS compilation
- Saves bundle to memory, and watch for changes
- Start a local web server presenting an index html with the bundle
- Include static files in the index
License
MIT
Icons made by Freepik from www.flaticon.com is licensed by CC 3.0 BY