Closed baermathias closed 1 year ago
If the following is your config:
const ejsPlugin = ViteEjsPlugin({ injectParagraphTag: `<p>this is a paragraph</p>`, injectScriptTag: `<script type="module"> const origin = window.location.origin; import(origin + '/modules/components@1.0.0/dist/index.umd.js') </script>`, injectLinkTag: `<link rel="stylesheet" href="/../modules/components/css/fonts.css" />`, injectCustomElement: `<custom-link-tag rel="stylesheet" href="/../modules/components/css/fonts.css" />`, })
And these are the ejs tags in your index.html:
<%- injectParagraphTag %> <%- injectScriptTag %> <%- injectLinkTag %> <%- injectCustomElement %>
Then this will be the result:
<p>this is a paragraph</p> <custom-link-tag rel="stylesheet" href="/../modules/components/css/fonts.css" />
Is there any specific reason why you want to inject scripts as variables? Won't a partial work better?
Due to no response on this.. i will close this issue.
If the following is your config:
And these are the ejs tags in your index.html:
Then this will be the result: