Open s0kil opened 4 years ago
Instead of having to run a Parcel build step, and then subfont, it will be done in one go.
I'm not super familiar with the api that Parcel exposes to plugins, but it's probably possible. Might require a heavy restructuring of subfont itself to make it less dependent on assetgraph, which I'm not sure that we want.
A bundler for parcel would be more correct in terms of its lifecycle.
It would be completely possible to build this, but it would probably not be a whole lot faster unless we accidentally have the same AST abstraction in Parcel and Assetgraph so we could skip the heavy parsing work. I can see they use postcss as well, but the dom representation differs.
I imagine you could build such a plugin, iterate through all the html, css and font assets on the parcel graph and manually feed them into assetgraph to get our representation, then run something like https://github.com/parcel-bundler/parcel#bundler on it and load all the updated and added assets back into the parcel graph
I also see this as seperate project, that just happens to use subfont. Like https://github.com/Munter/netlify-plugin-subfont
I was wondering if subfont could have an optimer plugin for Parcel v2?