douglasduteil / angular-utility-belt

My non-lethal angular gadgets
http://douglasduteil.github.io/angular-utility-belt
MIT License
3 stars 1 forks source link

Better solution for pages #33

Closed douglasduteil closed 10 years ago

douglasduteil commented 10 years ago

I made a monster :(

I have real doubts with the generated pages... Think we need to make it do more/less somehow... And nunjucks isn't that good... I can't extend a block inside a included file.

Example :

<!-- base.nunjucks -->
<html>
{% include 'head' %}
</html>
<!-- head.nunjucks -->
<head>
{% block foo %}
head#foo - Should be overwritten
{% endblock %}
</head>
<!-- out.nunjucks -->
{% extend 'base' %}

{% block foo %}
out#foo Should overwrite the foo block in the head.nunjucks file 
{% endblock %}

Maybe I'm doing it all wrong I didn't try any thing else. But maybe this is more correct ?

<!-- base.nunjucks -->
{% extend 'default' %}

{% block head %}
<head>
  {% block foo %}
  base#foo - Should be overwritten
  {% endblock %}
</head>
{% endblock %}
<!-- default.nunjucks -->
<html>
{% block head %}
default#head - Should be overwritten
{% endblock %}
</html>
<!-- out.nunjucks -->
{% extend 'base' %}

{% block foo %}
out#foo Should overwrite the foo block in the base.nunjucks file 
{% endblock %}

what you think ?

revolunet commented 10 years ago

you mean you can't overwrite a block who's included in the extended template ? example 1 doesnt work ?

maybe we can flatten a little bit the "base" template, and thus remove some complexity ?

<!-- base.nunjucks -->
<html>
    <head>
        {% block foo %}
            head#foo - Should be overwritten
        {% endblock %}
    </head>
</html>
douglasduteil commented 10 years ago

Yeah true a flatten version definitely works Thanks :+1:

revolunet commented 10 years ago

available to talk about that monster and what we can do about it...