I have a set of html files, mostly static, I would like to move to my node.js/express/jade project. What's the right way to include html file or snippet directly in jade? I don't want to translate existing html file to jade?
You should be able to simply include
it within a jade template:
As mentioned
include
can be used to include other content such as html or css. By providing an extension, Jade will read that file in, apply any filter matching the file's extension, and insert that content into the output.
html // ... body // ... //- html files have no filter and are included verbatim include content.html
Use :verbatim
before the exact html code or snippet directly in jade.
doctype html html(lang="en") :verbatim {% include head.html %} body :verbatim {{ content }} :verbatim {% include footer.html %}
Output
<!DOCTYPE html> <html lang="en">{% include head.html %} <body>{{ content }} </body>{% include footer.html %} </html>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With