html-replace-webpack-plugin
html-replace-webpack-plugin copied to clipboard
Use in a template
Your plugin is simple and awesome, but how can I use it just in a template, for example:
template.html
<h1><%= title %></h1>
<p><%= description %></p>
<a href="evil.com" @blank></a>
index.js
import template from './template.html';
setTimeout(() => {
const html = microTmpl(template, {
title: 'The Title',
description: 'Best Description Ever',
});
console.log(html);
}, 1000);
webpack.config.js
new HtmlReplaceWebpackPlugin([{
pattern: '@blank',
replacement: 'target="_blank" rel="noopener noreferrer"',
}]),