Closed ianpetrarca closed 1 year ago
I just reproduced the error, but I still don't understand the solution you are proposing,
can you give a code preview of what the option should look like?
For now if very urgent you can use these hacks if you find them comfortable. https://stackblitz.com/edit/vite-plugin-ejs-esc?file=index.html,vite.config.js
line 14 and 15 vite.config.js
line 12, 13, 14 index.htm
@ianpetrarca your response would be appreciated
Hey,
This plugin is great. Would it be possible to add an option that allows you to insert the EJS template strings back into the built HTML files instead of replacing them with the data you provide in the vite.config.js file?
For example the plugin with this config + html:
ViteEjsPlugin({ username: "Bob Smith" }),
<h1>Display <%= username %></h1>
Will Output this HTML on build:
<h1> Bob Smith </h1>
Is it possible to add an option to the plugin that makes it ouput the original h1 with EJS template:
<h1>Display <%= username %></h1>
The reason I am asking for this is that ViteJS by default, will throw an error when you try and use an EJS template string. This plugin is the only way I can use EJS strings in my ViteJS project without having errors.
Error that occurs when trying to use EJS templates without this plugin:
[vite] Internal server error: Unable to parse HTML; parse5 error code invalid-first-character-of-tag-name