0.2.4 • Published 6 years ago

devbundle v0.2.4

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

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

Configs

Required

  • context: Path to the main project directory where the module is running
  • input: Path to input script for the bundle (javascript file)

Optional

  • title: Title, used in the presented index html
  • icon: Presentation icon, available: app, camera, chart, chat, cloud, cube (default), html, location, music, phone, plane, pointer, shield, shopping, users, windows
  • include: Static files to include in the html presentation
  • include.css: Array of static css include file paths
  • include.js: Array of static jsvascript include file paths
  • port: Web server port
  • hostname: 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