velocity-injectable-loader
v0.0.3
Published
velocity templates loader with ability to inject data
Downloads
20
Maintainers
Readme
Velocity Injectable Loader
velocity templates loader for webpack.
somewhat configurable.
inspired by velocity-loader but this one allows you to set data source to be injected
Installation
npm i velocity-injectable-loader
Usage
No data injection
either use directly with imports
(require
s):
import 'velocity-injectable-loader!index.vm';
// or
require('velocity-injectable-loader!index.vm');
or use with, e.g., HtmlWebpackPlugin
:
plugins: [
new HtmlWebpackPlugin({
template: 'velocity-injectable-loader?inject=data.js!./src/index.vm',
inject: false
})
]
With data injection
when ./velocity.vm
contains:
Hello ${name}
and ./injectables.js
contains:
module.exports = {
name: 'Doggo'
};
then ./some-file.js
:
import injected from 'velocity-injectable-loader?inject=injectables.js!velocity.vm';
will output Hello Doggo
.