Error using blocks at Nunjucks

Am I able to insert blocks inside a set element with Nunjucks? Like this:

        {% set css %}
        {% block includeCSS %}
            {% include "styles.css" %}
        {% endblock %}
        {% endset %}

        {% set js %}
        {% block includeJS %}
            {% include "script.js" %}
        {% endblock %}
        {% endset %}

When I’m running this file:

{% extends 'layouts/default.njk' %}
{% block includeCSS %}CONTENT{% endblock %}

I’m getting an error:

Template render error: (./src/_includes/layouts/default.njk)
      Error: unknown block "includeJS"

I basically need to have all blocks inside the child template, is there any way to avoid this?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.