metalpress icon indicating copy to clipboard operation
metalpress copied to clipboard

Cannot pass in preMiddleware or postMiddleware

Open nathanbowser opened this issue 8 years ago • 2 comments

  1. 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.
  2. This comment is wrong https://github.com/axisdefined/metalpress/blob/master/src/index.js#L151-L159
  3. Should preMiddleware be defined in the middle? Or in the beginning? Right now this seems to be a bit of a weird spot.
  4. The tests for middleware are all commented out.

nathanbowser avatar Oct 06 '16 14:10 nathanbowser

Hey @nathanbowser, thanks for spotting that. Yes, I'll be addressing these things as you mention.

  1. 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.
  2. Will fix that.
  3. 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?
  4. Yes, I will be fixing those when I have a moment. Should be cleaned up soon.

ninjasort avatar Oct 11 '16 19:10 ninjasort

Sounds good.

Re:

  1. Yup, we would like the ability to use these middleware callbacks.
  2. 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.

nathanbowser avatar Oct 11 '16 19:10 nathanbowser