A fork of 'olalonde/better-require' - lets you load JSON and YAML files using require syntax. For example: var config = require('./config.json'); Extensions available are: json, yaml, coffee, ts, ls, co
v0.3 also works well with coffee-script -post & pre 1.7.x- (.coffee, .litcoffee, .coffee.md, ) & also LiveScript (.ls) & coco (.co).
Formats (& dependencies) removed:
You can still manually install them of course...
Original docs follow:
Augments require() with support for multiple file formats.
... which return a JSON represenation:
... work in progress:
Behind the scenes, this module adds handlers to require.extensions.
npm install better-require
/*** @param*/// support all available extensions;// support a subset of extensionsformats;
Enable support for all file types:
;var config = ;console;
Enable support for only a subset of file types:
'json yaml xml';// we can now require .xml, .yaml and .xml files!var config = ;console;