I'm planning to use jade templates to generate different htmls depending on if it is in development or in production. At this time, I'm not planning to write code in node. Given this, is it possible to invoke jade from commandline and pass variables? If so, how?
if, index.jade is
!!! 5
html
head
title my jade template
body
h1 Hello #{name}
I want to invoke it from command line passing value for name.
Thank you
You need to use the option -O
/--obj
within the Jade CLI. It accepts 2 type of values:
For example:
jade -O myfile.json template.jade
or
jade --obj '{ "cache": true }' template.jade
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