Open brianhartsock opened 5 years ago
Have you tried.... just flipping the arguments? {% asset image.png magick:half @optim %}
?
Yup, didn't have any impact on the order.
I don't know that I want literal priorities, but a quick look at the source shows it doesn't necessarily respect the order of arguments even though I explicitly state arguments are positional and respected in the parser (but not necessarily in Jekyll-Assets.)
I'll have a quick thought about whether I'd rather move to priorities, or implement a pop, and push algorithm to sort based on the positional order of arguments, more than likely I'll land on the latter as I already feel like the way we handle plugins is a bit complicated and needs a bit of rework, and I tend to fall on the latter side of "unless it's necessary, convention first, configuration on request"
Description
Optim and Magick processing order is not optimal or configurable. If you use both Magick and Optim on an image, results are sub-par with Optim running first then magick.
Steps
Try the following asset options on the same image:
{% asset image.png @optim magick:half %}
{% asset image.png @optim %}
{% asset image.png magick:half %}
Output
Respectively:
Expected
Obviously this shows that magick isn't optimizing the image after resize which is expected. In an ideal world, optim would always be run after magick IMO but there may be scenarios I haven't thought about.
The root of the problem appears that in
proxy.rb
, theProxy.proxies_for
method returns the classes in whatever orderProxy.inherited
returns.I was able to monkey patch with the following code to get a 204k file size:
I imagine there might be better ways to do this as I'm not a Jekyll plugin expert.