etpl-loader
Install
npm i etpl-loader -S
Usage
index.tpl
<p><%=name%></p><p><%=email%></p><ul> <%for (var i=0; i<skills.length; i++) {var skill = skills[i];%> <li><%-skill%></li> <%}%></ul><div> <%projects.forEach((project) => {%> <div> <h3><%-project.name%></h3> <p><%=project.description%></p> </div> <%});%></div><%include('footer.tpl')%>
footer.tpl
<div>Copyright © <%=site.year%> <%=site.name%>. All Rights Reserved.</div>
index.js
; window { return Stringstr ;}; documentinnerHTML = ;
webpack.config.js
moduleexports = module: rules: test: /\.tpl$/ use: 'etpl-loader'
Options
Name | Type | Default | Description |
---|---|---|---|
globals |
{Array} |
['window', 'console'] |
Global variables |
encode |
{String} |
'ENCODE' |
Encode function name |
Report a issue
License
etpl-loader is available under the terms of the MIT License.