posthtml/posthtml-include

Hmm, just tried this with `posthtml-include` and it still fails?

Scrum opened this issue · 1 comments

Scrum commented

Hmm, just tried this with posthtml-include and it still fails?

<!-- page is an object I already have -->
<include src="footer.html" locals="page">
<!-- footer.html -->
<div>Copyright {{ year }}</div>
SyntaxError: Unexpected token p in JSON at position 0 at JSON.parse

Note: let's leave posthtml-fetch aside for a moment. The above is just using the extend, expressions and include plugins, like so:

const config = { /* an object I already have */ }

posthtml([
    require('posthtml-extend'),
    require('posthtml-include'),
    require('posthtml-expressions')({ locals: { page: config } }),
    ...posthtmlPlugins
  ])
    .process(html)
    .then(result => result.html)

Originally posted by @cossssmin in posthtml/posthtml-expressions#70 (comment)

Scrum commented

@cossssmin publish posthtml-include@1.4.2