Augments require() with support for multiple file formats. Node.js / NPM package
JavaScript Clojure LiveScript TypeScript Other
Latest commit 2d16261 May 15, 2015 @olalonde Update
Failed to load latest commit information.
examples added example file Jul 2, 2013
.gitignore initial commit Oct 22, 2012
LICENSE Added MIT license Oct 22, 2012 Added support for typescript Nov 1, 2012
index.js added line about livescript in the readme Jul 2, 2013
package.json added Livescript support Jul 2, 2013

NPM version

LOOKING FOR MAINTAINER: I don't have time to maintain this module at the moment and would like to let someone to takeover. Let me know in the issues if you're interested!

Augments require() with support for multiple file formats.

Supported file formats

... which return a JSON object:

... which return a Javascript module:

... work in progress:

  • dynamic libraries
  • ruby
  • python

Behind the scenes, this module adds handlers to require.extensions.


npm install better-require


 * @param {String} optional - formats is a white space separated list of formats you would like require() to support.
// support all available extensions
// support a subset of extensions


Enable support for all file types:


var config = require('./config.json');

Enable support for only a subset of file types:

require('better-require')('json yaml xml');

// we can now require .xml, .yaml and .xml files!
var config = require('./config.yaml');