philicevic / mix-html-builder

A quick laravel mix extension to build up html templates from partials and layouts.
MIT License
19 stars 8 forks source link

Unable to compile files #31

Closed me-awesome closed 3 years ago

me-awesome commented 3 years ago

Hi,

I include the extension and try to build the files but if I am placing extends an try to include files or blocks or slot/fills that are not compiling.

master.html

<!doctype html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="author" content="Awesome9">
        <title><slot name="title">· TEMPLATE_NAME</slot></title>
    </head>

    <body>

        <main class="container">

            <slot name="content"></slot>

        </main><!-- /.container -->

    </body>

</html>

index.html

<extends src="master.html">

    <fill name="title">Page title</fill>

    <fill name="content">
        <p>sssssssssssssssss</p>
    </fill>

    <include src="button.html" locals='{
        "text": "Button"
    }'></include>

</extends>

Output

<!doctype html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width,initial-scale=1">
        <meta name="author" content="Awesome9">
        <title><slot name="title">· TEMPLATE_NAME</slot></title>
    </head>

    <body>

        <main class="container">

            <slot name="content"></slot>

        </main>

    </body>

</html>
me-awesome commented 3 years ago

@philicevic can you please help me with this

philicevic commented 3 years ago

Sorry for the late answer, you probably worked this out already.

You are using slot and fill as tag names for the passed content. But you need to use block as mentioned in the docs.

However, as I was testing this, it turns out there is an issue with posthtml-parser that makes it impossible to put a block into a title tag.