Skip to content

A loader for webpack which substitutes the content of a file

License

Notifications You must be signed in to change notification settings

martinkr/substitute-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A loader for webpack which substitutes the content of a file

Resources

License

Stars

Watchers

Forks

Packages

No packages published