html-replace-webpack-plugin icon indicating copy to clipboard operation
html-replace-webpack-plugin copied to clipboard

Use in a template

Open DimaGashko opened this issue 4 years ago • 0 comments

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"',
}]),

DimaGashko avatar Sep 10 '19 23:09 DimaGashko