1.0.0 • Published 8 years ago

substitute-loader v1.0.0

Weekly downloads
27
License
MIT
Repository
github
Last release
8 years ago

Substitute loader for webpack

Replaces the content of a file. Defaults to nullbut you can supply the new content as parameter.

Install

$ npm i -S substitute-loader

Usage

module: {
    loaders: [ {
        test: /\.mock.json$/,
        // default
        loader: "substitute"
         // custom content
         // loader: "substitute?{content: '{}'}"
        
    } ]
}
// default, mock will equal null
var emptyMock = require("substitute!./mock.json");
// custom, mock will equal "{}"
var emptyMock = require("substitute!./mock.json?" + JSON.stringify({}));

Documentation: Using loaders.

License

MIT