Pass variables to jade template from commandline

后端 未结 1 788
Happy的楠姐
Happy的楠姐 2021-02-14 09:12

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. Giv

1条回答
  •  我在风中等你
    2021-02-14 09:37

    You need to use the option -O/--obj within the Jade CLI. It accepts 2 type of values:

    • Serialized JSON
    • A path to a JSON file (this takes precedence)

    For example:

    jade -O myfile.json template.jade
    

    or

    jade --obj '{ "cache": true }' template.jade
    

    0 讨论(0)
提交回复
热议问题