DEV Community

[Comment from a deleted post]
Collapse
 
daviddalbusco profile image
David Dal Busco • Edited

What do you mean? How would you solve this in a rollup build for example if you want to apply the variables after the build has completed? Happy to hear about any possible improvements :)

Collapse
 
pavelloz profile image
Paweł Kowalski

Well, ejs takes a template (string, from whatever source, ie. from a file) and data in form of the object (which you take from whatever source) and outputs a string (which you handle however you want), that you can save to a file.

You can either write very simple rollup plugin, or use existing one (i assume there is already one), or run it as node myscript.js - "Its just javascript", as they say :)

 
daviddalbusco profile image
David Dal Busco

Oh now I understand, thank you for the explanation. That's an option but then your compiler should accept it respectively it's probably only possible if you can hook on a pre-build lifecycle or something, but yes, that's a good idea! Thx for the feedback.