0.0.4 • Published 10 years ago

hapi-browserify v0.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

hapi-browserify

npm Dependency Status

Browserify handler for hapi (inspired by browserify-middleware).

Table of Contents

Installation and Configuration

npm install hapi-browserify --save
server.register({
  register: require('hapi-browserify'),
  options: {
    ...
  }
});
Options

Configures the default options for routes.

  • path - path to bundle file.
  • cache - boolean, configures the handlers caching strategy. This does not set cache headers on the response - you should still use hapi for that.
  • minify - enable uglify, only recommended if cache is true.
  • precompile - precompile bundles where possible. Only works if cache is true.
  • bundle - browserify options, plus options for require, exclude, external, transform

Example Usages

See options for all available options.

# Fixed path

server.route({
  method: 'GET',
  path: '/my-script.js',
  handler: {
    browserify: {
      path: './scripts/my-script.js'
    }
  }
});

# Dynamic path

server.route({
  method: 'GET',
  path: '/script/{param*}',
  handler: {
    browserify: {
      bundle: {
        basedir: './script/'
      }
    }
  }
});
0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago