Block in title results in unexpected block
MattIPv4 opened this issue · 4 comments
With posthtml@0.13.4 & posthtml-extend@0.5.0, the following works just fine:
<html>
<head>
<title><block name="title"></block> — Github</title>
</head>
<body>
<div class="content">
<block name="content"></block>
</div>
</body>
</html>
<extends src="base.html">
<block name="title">How to use posthtml-extend</block>
<block name="content">Read the documentation</block>
</extends>
With posthtml@0.13.4 & posthtml-extend@0.5.1, it errors:
[posthtml-extend] Unexpected block "title"
at getError (node_modules/posthtml-extend/lib/extend.js:228:12)
at mergeExtendsAndLayout (node_modules/posthtml-extend/lib/extend.js:156:23)
at node_modules/posthtml-extend/lib/extend.js:91:31
at node_modules/posthtml/lib/api.js:91:45
at traverse (node_modules/posthtml/lib/api.js:105:26)
at Array.match (node_modules/posthtml/lib/api.js:90:7)
at handleExtendsNodes (node_modules/posthtml-extend/lib/extend.js:81:16)
at node_modules/posthtml-extend/lib/extend.js:45:16
at node_modules/parcel-bundler/node_modules/posthtml/lib/index.js:188:14
at tryCatch (node_modules/parcel-bundler/node_modules/posthtml/lib/index.js:271:12)
@MattIPv4 Hi, thanks for contacting us. The reason lies in the parsing that we recently updated.
Now we are solving this problem, I can offer as an alternative to use such a block
base.html
<head>
<block name="title"><title> — Github</title></block>
</head>
index.html
<block name="title"><title>How to use posthtml-extend</title></block>
Changing how we generate the base template would be a pretty major breaking change across a load of our projects -- if this dependency bump has caused a breaking change for the library, that should really be a major version release, not a patch (which it was)?
Changing how we generate the base template would be a pretty major breaking change across a load of our projects -- if this dependency bump has caused a breaking change for the library, that should really be a major version release, not a patch (which it was)?
Yes, you are definitely right. I will try to settle this moment
@MattIPv4 @cossssmin This is a temporary solution for the transition to a new version of posthtml, it must be included in your project at the very beginning of the plugins