Community
How to use 'include' in traditional forms (pug.js)?
2 months ago by Vesa Jolkkonen
Is there a way to import some html code from another file when developing form with pug.js?
I'd like to make a custom reusable component such as:
mixin customComponent
p Hello from another file!
However, when I try to use include components.pug
in my form file, I get following error:
Error: ENOENT: no such file or directory, open 'templates/form/show-more.pug'
So it seems like include assumes that it's root folder is templates/ which is not easily accessible by us, I assume? Is there a way to do 'include', or is there better solution for this?
I know that with Helix I can achieve this easier but we have lots of old forms to maintain, as well.