Nunjucks Pathrunner is a simple VS Code extension that enables Ctrl + click and Go to Definition support for Eleventy / Nunjucks template paths (
.njk).
Features
- Ctrl + click support for
.njktemplate paths - Go to Definition (
F12) integration - Support for common Eleventy / Nunjucks template tags
- Workspace-specific settings support
- Configurable base include path
Perfect for Eleventy / Nunjucks projects that use many reusable Nunjucks templates, partials, layouts and macros.
Supported syntax
The extension supports static template paths used in:
{% include "component/file.njk" %}
{% from "section/file.njk" import macro %}
{% extends "layout/base.njk" %}
{% import "macro/forms.njk" as forms %}
Supported tags:
includefromextendsimport
Usage
Hold:
Ctrl + click
on a .njk template path to open the referenced file.
You can also use:
F12 → Go to Definition
The behavior is similar to native JavaScript imports in VS Code.
Configuration
Nunjucks Pathrunner uses a base include path to resolve template references.
Default value:
"nunjucksTemplatePath.includePath": "src/view/_include"
This means that a template reference like:
{% include "component/card.njk" %}
will be resolved as:
src/view/_include/component/card.njk
You can configure the base path globally or per workspace.
Open settings:
File > Preferences > Settings > search "Nunjucks Pathrunner Path"
or edit your settings.json:
{
"nunjucksTemplatePath.includePath": "src/view/_include"
}
You can change the path to match your project structure:
{
"nunjucksTemplatePath.includePath": "src/_includes"
}
Notes:
src/view/_includeis only the default value- The path can be customized freely
- Workspace settings are supported, so each project can use a different include path
Dynamic paths limitation
The extension can resolve only static template paths.
Examples that work:
{% include "component/card.njk" %}
{% from "section/card-awesome.njk" import cardAwesome with context %}
Examples that cannot be resolved:
{% include somePath + ".njk" %}
{% from someVar + "/card-awesome.njk" import cardAwesome with context %}
Dynamic paths cannot be resolved reliably because the final template path depends on runtime variables, data files, front matter, global data, computed data or template context.
Compatibility
This extension works only in VS Code Desktop. It is not supported in VS Code Web (vscode.dev / github.dev).
Why Nunjucks Pathrunner?
Eleventy and Nunjucks projects often rely on reusable templates split across many folders.
Without native navigation support, moving between includes, layouts and macros can become slow and repetitive.
Nunjucks Pathrunner improves the editing experience by making static .njk template references behave like regular code imports.
DevTeam
ARMADA 429

Lorenzo "Saibal" Forti - [email protected]