Optimize jpeg images using assetic from css file instead of image tag -
the article below i'm trying do, instead of working on <img>
tags want work references made in css well, background-image:url('someimage.jpg');
make optimizing hundreds of images have on website far faster manually doing , more convenient.
for example documentation how using twig templating engine.
{% image '@appbundle/resources/public/images/example.jpg' filter='jpegoptim' output='/images/example.jpg' %} <img src="{{ asset_url }}" alt="example"/> {% endimage %}
is possible assetic , jpegoptim (or through other solution)
http://symfony.com/doc/current/cookbook/assetic/jpeg_optimize.html
your best bet, honestly, write script jpegoptim
existing files.
it's possible want creating new assetic filter, if want save jpegs different location (what using image tag filter now), little detail looks it'd quite hard. if used filter find , rewrite images in-place, have big clunky version of script find , optimize images, , it's fair bit of work not gain.
Comments
Post a Comment