https://github.com/martinkr/substitute-loader
A loader for webpack which substitutes the content of a file
https://github.com/martinkr/substitute-loader
Last synced: 4 months ago
JSON representation
A loader for webpack which substitutes the content of a file
- Host: GitHub
- URL: https://github.com/martinkr/substitute-loader
- Owner: martinkr
- License: mit
- Created: 2016-11-01T11:47:27.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-11-01T12:09:14.000Z (over 8 years ago)
- Last Synced: 2025-03-07T12:33:26.301Z (4 months ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Substitute loader for [webpack](https://webpack.github.io/)
Replaces the content of a file. Defaults to ```null```but you can supply the new content as parameter.
## Install
```sh
$ npm i -S substitute-loader```
## Usage
```javascript
module: {
loaders: [ {
test: /\.mock.json$/,
// default
loader: "substitute"
// custom content
// loader: "substitute?{content: '{}'}"
} ]
}
``````javascript
// 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](https://webpack.github.io/docs/using-loaders.html).
## License
[MIT](http://choosealicense.com/licenses/mit/)