0

I want to use a variable provided from my CMS to reference an include template like this:

extends layout
    include layouts/#{data[0].fields.layout}.pug

This just looks for layouts/#{data[0].fields.layout}.pug rather than what I wan, e.g. main.pug. Is there a way to do this?

userqwert
  • 2,193
  • 5
  • 28
  • 50
  • Possible duplicate of [Use a variable in a Jade include](https://stackoverflow.com/questions/12132978/use-a-variable-in-a-jade-include) – Mirza Sisic Sep 06 '17 at 19:32

1 Answers1

1

Unfortunately, this is not possible at the moment. Dynamic includes are currently not supported by Pug (see this SO answer and this Github issue).

gandreadis
  • 3,004
  • 2
  • 26
  • 38