0.1.0 • Published 8 years ago

null-register v0.1.0

Weekly downloads
1,010
License
ISC
Repository
github
Last release
8 years ago

Why?

Say you're using style-loader in order to do something neat like:

var css = require('./my.css');

This works just fine when you're building with webpack to run in the browser. But if you want to run outside of the browser environment (say in order to test with JSDom), then things break. This module fixes that.

Use via package.json

{
  "name": "package-name",
  "null-register": [".css", ".less"]
}

Environment variables

Null register can read extensions from the $NODE_NULL_REGISTER environment variable. For example, to use null-loader with Mocha to stub out CSS and LESS requires:

NODE_NULL_REGISTER=".css .less" mocha --compilers css:null-loader

Programmatic Usage

Simply make the following call before calling require for the given extensions:

require('null-loader')(['.css', '.less']);

Changelog

  • 0.1.0: Add support for loading via package.json
  • 0.0.1: First version