tpl-lite-loader

0.1.0 • Public • Published

感谢(Thanks)

感谢 tpl-loader给我的灵感

安装(Installation)

npm install tpl-lite-loader

使用(Usage)

Documentation: Using loaders

  1. 直接在require方法上使用
    var template = require("tpl-lite!./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
  2. webpack.config.js使用
    module: {
    	loaders: [{
    		test: /\.tpl$/,
    		loader: "tpl-lite"
    	}]
    }

你还可以自定义自己的template配置, 比如

    module: {
    	loaders: [{
    		test: /\.tpl$/,
    		loader: "tpl-lite"
		    tplSettings: {
		        escape: /\{\{([^{].*?)\}\}/gm,
		        interpolate: /\{\{\{(.+?)\}\}\}/gm,
		        evaluate: /\{\%(.+?)\%\}/g
		    }
    	}]
    }
    ...

License

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

Package Sidebar

Install

npm i tpl-lite-loader

Weekly Downloads

0

Version

0.1.0

License

MIT

Last publish

Collaborators

  • monkindey