pug-php / pug

Pug template engine for PHP
https://www.phug-lang.com
MIT License
391 stars 42 forks source link

Can't import mixins #121

Closed s4msung closed 7 years ago

s4msung commented 7 years ago

When including a template which declares a mixin, it's undefined in the current template.

I have packaged a demonstration: sample.zip

Just run:

php run.php

it should shout about undefined index item_mixin_mixin

kylekatarnls commented 7 years ago

Pug 2.5 handle only blocks after an extends, so you just have to put your include in each block that use the mixin:

extends main

block content
    include item_mixin

    .container
        h2 Example pages
        ul.navlist
            each item in items
                +item_mixin(item)

It will be fixed in 3.0.

kylekatarnls commented 7 years ago

You can update to 3.0.0-alpha2, it should be fixed. Please don't hesitate to test the new pug-php 3 and give us your feedback.