metalpress
metalpress copied to clipboard
Cannot pass in preMiddleware or postMiddleware
- Looks like metalpress-cli expects the metalpress config to be a json file, but your preMiddleware and postMiddleware blocks accept functions https://github.com/axisdefined/metalpress/blob/master/src/index.js#L203-L211.
- This comment is wrong https://github.com/axisdefined/metalpress/blob/master/src/index.js#L151-L159
- Should
preMiddleware
be defined in the middle? Or in the beginning? Right now this seems to be a bit of a weird spot. - The tests for middleware are all commented out.
Hey @nathanbowser, thanks for spotting that. Yes, I'll be addressing these things as you mention.
- The goal with the .metalpress file was to remove the need for any code and keep it to a configurable build. If you're wanting to pass in middleware, I could look into this and make it so you can just pass in an object with functions attached.
- Will fix that.
- preMiddleware is pre in regards to the template rendering, not the entire build. Is there a reason you would need a hook before any of the other plugins?
- Yes, I will be fixing those when I have a moment. Should be cleaned up soon.
Sounds good.
Re:
- Yup, we would like the ability to use these middleware callbacks.
- Not particularly. Just seemed like it might be a bug because it's called
pre
and was in the middle so figured I'd point it out in case.