A loader for webpack which substitutes the content of a file
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
LICENSE
README.md
index.js
package.json

README.md

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