Open umaar opened 7 years ago
I should add: even if it's not promise based, at least a callback would be nice. I don't see how any async code can be used in evaluate
No way now. And since this package is not actively maintained, i don't think this feature will appear.
That's a shame, but thanks for the input.
See https://github.com/nodeca/mincer/issues/150 for explanations. Initial concept (sprockets port) is not good for component-based approach, because too file-centric. Probably, this can be reworked as independent package, but i have no resource for that. If anyone wish to continue, i can add permissions and make full permissions transfer later (if everything goes well).
Ok good to know. I'm interested in this file: bundle.js file, it looks like you're using it as an alternative to mincer.
Do you find it works better? What are your thoughts on some of the other build tools out there like Gulp/webpack etc. which can also do all of those things via plugins - and also allow programmatic usage.
Do you find it works better?
It's better for my needs, because i don't have to think about all possible use cases, engines, extensions and documentation.
What are your thoughts on some of the other build tools out there like Gulp/webpack etc. which can also do all of those things via plugins - and also allow programmatic usage.
IMHO, that works well only until you have simple requirements. When you need something more, you will spend half of time to fight with bad api and push your needs to upstream :).
I'm sure, this can be generalized somehow, but this requires significant time and experience. At this time i don't know good package that can help to solve this problem. When it appears, i'll be happy to use it.
Fair enough, I admire the effort you've put into, for example, plugins, it's interesting to see. Thanks for explaining!
If you decide to dig nodeca bundler or create your own, pay attention to macros implementation and related things. The most painful problem is that you can have only sync helpers in html templates, but may wish async imlementations of plugins. If helper's dependencies (asset's url for example) are not ready, you can't silently build those after helper invoked.
Solution is to throw error "unfulfiled dependencies", build missed ones and rerun build of resource that caused error. At least, that worked with my use cases. That's the main logical collision you should care if you decide to create complicated assets bundler.
I was hoping to make a mincer plugin for Rollup, however their API is promise based. Could you support this in
Template.prototype.evaluate
?Right now, if I specify a Promise based function for
evaluate
, when Mincer invokesevaluate
, it won't wait for the Promise to resolve.Also see this Stackoverflow question: http://stackoverflow.com/questions/21424867/run-an-asynchronous-stream-based-function-synchronously-in-node-js