1.0.0 • Published 7 years ago

lodash-template-source-loader v1.0.0

Weekly downloads
2
License
Unlicense
Repository
github
Last release
7 years ago

lodash-template-source-loader

Compile a lodash template and load its source. I can't believe this didn't already exist.

Usage

webpack.config.js:

module.exports = {
  module: {
    // ...
    rules: [
      // ...
      {
        test: /\.html$/,
        use: 'lodash-template-loader',
      }
    ],
  },
};

index.js:

import template from './index.html';

// <div>bar</div>
template({ foo: 'bar' });

index.html:

<div><%- obj.foo -%></div>