0.0.3 • Published 8 years ago

velocity-injectable-loader v0.0.3

Weekly downloads
1
License
ISC
Repository
-
Last release
8 years ago

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 (requires):

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.