posthtml / posthtml-extend

Template extending (Jade-like)
MIT License
46 stars 9 forks source link

Plugin execution fails when `posthtml-expressions` is not installed #52

Closed Philzen closed 1 year ago

Philzen commented 2 years ago

We have a small static site with a Parcel + Tailwindcss setup as recommended on the tailwind css docs.

Installed posthtml-extend and created a .posthtmlrc file with contents:

{
  "plugins": {
    "posthtml-extend": {}
  }
}

Upon trying to fire up the build process, it spews out:

> site@1.0.0 dev
> parcel src/index.html

Server running at http://localhost:1234
🚨 Build failed.

@parcel/transformer-posthtml: Could not resolve module "posthtml-expressions" from "/home/philzen/prog/site/node_modules/posthtml-extend/lib/index.js"

Adding posthtml-expressions explicitly to the local project solved it – posthtml-extend now works like a charm and does exactly the one job i was looking for – separating a base layout from content as we're beginning to add more pages. Thanks for creating this plugin BTW.

Hence i believe, moving the dependency upwards from dev to prod in

https://github.com/posthtml/posthtml-extend/blob/ccf454a4b0ead941626bd7c09aae79c0e8c2388c/package.json#L55

would avoid this issue – and remove the need to explicitly add the dependency to the consuming project (even if it is not needed there).

If you agree i'd be happy to hand in a PR.