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

Passing variables inside extends #19

Closed weblabio closed 3 years ago

weblabio commented 4 years ago

Is it possible to pass variables to an extensible template? similar to how this is done in include

home.html

<extends src="app" locals='{
    "pageTitle": "Home",
    "pageClass": "page-home",
}'>
    ...
</extends>

layouts/app.html

<head>
     <title>{{ pageTitle }}</title>
</head>
<body class="{{ pageClass }}">
....
</body>

otherwise the extends functionality does not make sense, since the expandable part into reality can almost never be static

philicevic commented 4 years ago

I'm not quite sure if it is possible or not, because we're depending on posthtml-extend. If I'll somehow be able make it work using their plugins option, I'll try to add it.

The extend functionality can make sense. It depends on the way you're using it. In your case it's obviously a problem that you cannot pass data.

philicevic commented 3 years ago

This pull request will make this possible. Waiting for it to get merged.