Home  >  Q&A  >  body text

javascript - How to modify the template directory using nunjucks?

The default configuration on the official website is

    nunjucks.configure('views', { autoescape: true });
    

The template directory is under /views. If I want to change it to be under group directories such as /views/admin and /views/home, can this be achieved through configuration? Or do I need to modify the render method?

PHP中文网PHP中文网2697 days ago687

reply all(1)I'll reply

  • 阿神

    阿神2017-05-31 10:43:29

    If the framework provides middleware, you can intercept it in the middleware, then identify whether it is a front-end module or a back-end module, and finally configure dynamic nunjucks

    reply
    0
  • Cancelreply