substitute-loader

1.0.0 • Public • Published

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

Package Sidebar

Install

npm i substitute-loader

Weekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • martinkr