Skip to content

Micro mustache template loader for webpack

License

Notifications You must be signed in to change notification settings

best-shot/micro-tpl-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

micro-tpl-loader

Micro mustache template loader for webpack.

npm github node

Support MicroMustache interpolation. Not for Handlebars and Mustache.

Installation

npm install micro-tpl-loader --save-dev

Usage

// example: webpack.config.cjs

const params = {
  // define params here
  foo: 'bar',
  xyz: {
    abc: 123
  }
};

module.exports = {
  module: {
    rules: [
      {
        test: /\.tpl$/,
        use: {
          loader: 'micro-tpl-loader',
          options: {
            params
          }
        }
      }
    ]
  }
};
<!-- index.tpl -->
<div>{{ foo }}</div>
<div>{{ xyz.abc }} - test</div>

↓↓

<!-- index.html -->
<div>bar</div>
<div>123 - test</div>