Have ideas to improve npm?Join in the discussion! »

    budo

    4.1.0 • Public • Published

    budō

    stable

    This is a browserify development server inspired by beefy and wzrd, but specifically focused on incremental reloading and LiveReload integration (including CSS injection).

    To install:

    npm install budo -g

    Running budo will start a server with a default index.html and incrementally bundle your source on filesave. The requests are delayed until the bundle has finished, so you won't be served stale or empty bundles if you refresh the page mid-update. Examples:

    # serve file on port 9966 
    budo index.js
     
    # enable LiveReload on html/css/js changes 
    # show timing information on re-bundle 
    budo index.js --verbose --live
     
    # pass some options to browserify 
    budo index.js --live -- -t babelify --full-paths

    Then open http://localhost:9966 to see the content in action.

    To pretty-print in terminal, garnish, bistre or another ndjson-based stream can be used. Example:

    # install garnish if you don't have it 
    npm install garnish -g
     
    # pipe to garnish for pretty-printing 
    budo index.js | garnish

    See docs for more features. PRs/suggestions/comments welcome.

    docs

    usage

    NPM

    CLI

    Details for budo command-line interface. Other options (like -t) will be sent to browserify.

    Usage:
      budo [entries] [opts]
     
    Options:
      --help, -h       show help message
      --port           the port to run, default 9966
      --host           the host, default "localhost"
      --dir            the directory to serve, and the base for --outfile
      --serve          override the bundle path being served
      --live           enable LiveReload integration
      --live-plugin    enable LiveReload but do not inject script tag
      --live-port      the LiveReload port, default 35729
      --verbose, -v    verbose timing information for re-bundles
      --poll=N         use polling for file watch, with optional interval N
      --no-stream      do not print messages to stdout
      --no-debug       do not use inline source maps

    By default, messages will be printed to process.stdout, and --debug will be sent to browserify (for source maps). You can turn these off with --no-stream and --no-debug, respectively.

    Everything after -- is passed directly to browserify; this is currently needed for subarg syntax. Example:

    budo index.js --live -- -[ babelify --exetensions .es6 ]

    API

    The API mirrors the CLI except it does not write to process.stdout by default, and does not attempt to find available ports from a base port.

    var budo = require('budo')
     
    budo('./src/index.js', {
      live: true,             //live reload
      stream: process.stdout, //log to stdout
      port: 8000              //use this port
    }).on('connnect', function(ev) {
      //...
    })

    See API usage for more details.

    Script Injection

    screenshot

    (click for demo)

    The original motivation for making budō was to build a simple tool around Chrome Script Injection. This has since split off into its own repository: budo-chrome to minimize the scope of budō.

    License

    MIT, see LICENSE.md for details.

    Install

    npm i [email protected]

    Version

    4.1.0

    License

    MIT

    Last publish

    Collaborators

    • avatar
    • avatar