I have a setup where I'm using a component library that I have as an npm package. To use these components I need to extend templates that live outside of the /templates directory. So I need to achieve something like:

{% extends "../../../../node_modules/design-system/page-templates/_template.njk" %}

I will be extended from within a template that is located from within the /templates directory but allows for extends from outside of it.

Any help would be great.

1 Answer 1


You need to define and register your template roots for this folder:

    function(RegisterTemplateRootsEvent $e) {{
        $e->roots['my-fancy-prefix'] = 'someDir';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.