Skip to content

mlzxy/tpl-loader

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lodash template for webpack

Lodash template loader for webpack. Uses _.template function to compile templates.

Installation

npm install tpl-loader

Usage

Documentation: Using loaders

var template = require("tpl!./file.html");
// => returns the template function compiled with undesrcore (lodash) templating engine.

// And then use it somewhere in your code
template(data) // Pass object with data

You can add _.template settings as a tplSettings property inside webpack config file to specify options for the loader, for example:

    ...
    tplSettings: {
        escape: /\{\{([^{].*?)\}\}/gm,
        interpolate: /\{\{\{(.+?)\}\}\}/gm,
        evaluate: /\{\%(.+?)\%\}/g
    }
    ...

License

MIT (http://www.opensource.org/licenses/mit-license.php)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%