Integrating Nunjucks with IntelliJ IDEA / Webstorm

JoshuaDavid picture JoshuaDavid · Nov 6, 2015 · Viewed 7.3k times · Source

How can I add syntax highlighting to Nunjucks template files in IntelliJ IDEA / Webstorm?

There is no obvious plugin available. Perhaps there is something for a similar templating engine that would work?

Answer

JoshuaDavid picture JoshuaDavid · Nov 6, 2015

Just found a solution. Configure a custom extension with Twig files. It's a template engine with similar syntax (but for PHP).

  1. add Twig Support plugin if necessary

  2. Go to Settings -> Editor -> File Types and add find Twig

  3. Add the custom pattern *.njk.

Now all *.njk files are parsed as Twig so in the end you have support for Nunjucks.