fileify
Middleware for browserify to load non-js files like templates.
methods
var express = ; // or connect, whatevsvar app = express;var fileify = ; var bundle = ;bundle;app
fileify(name, dir, opts)
Make the files in dir
available through require(name)
.
require(name)
will then return the files hashed by filename.
fileify will do a recursive traversal of dir
and return all the files
except for hidden ones unless you specify a callback for opts.extension
.
Returns a middleware function with a '.end()' function to stop all the watches in watch mode.
opts can have:
-
watch - if true, update the fileified bundle when files change
-
extension - a filter function, regexp, string extension, or array of extensions to limit extensions to
If opts is not an object and not an array it will be interpreted as the extension.
example
simple/server.js
var express = ;var app = express; app;app;console; var browserify = ;var bundle = ;app; var fileify = ;bundle;
installation
With npm do:
npm install fileify
license
MIT/X11