injection-loader
v1.0.1
Published
Inject static content to file loader for Webpack Edit
Downloads
23
Maintainers
Readme
Injection Loader
A loader for webpack that lets you inject content to file.
Install
npm install --save-dev injection-loader raw-loader
Usage
Use the loader either via your webpack config, CLI or inline.
Note: Injection loader just INJECTION (guidelines), you can use it with raw-loader
to require non-js file.
webpack.config.js
:
module.exports = {
module: {
rules: [{
test: /\.md$/,
use: [
{
loader: 'raw-loader',
},
{
loader: 'injection-loader',
options: {
// default pattern
pattern: /__INCLUDE_FILE\('(.+)'\)/,
},
}
]
}]
}
}
In your application
import md from 'some.md';
some.md
:
# Title
## Sub title
- list 1
- list 1
__INCLUDE_FILE('./injection.txt')
Note: __INCLUDE_FILE
path (./injection.txt
) should RELATIVE to some.md
.