Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use in a template #18

Open
DimaGashko opened this issue Sep 10, 2019 · 0 comments
Open

Use in a template #18

DimaGashko opened this issue Sep 10, 2019 · 0 comments

Comments

@DimaGashko
Copy link

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"',
}]),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant