mmikkel / Retcon-Craft

A collection of powerful Twig filters for modifying HTML
MIT License
80 stars 9 forks source link

Conditionally add css class? #45

Closed mark-chief closed 1 year ago

mark-chief commented 1 year ago

Hello, is there way to conditionally add a class to an image based on a set width?

E.g if image width is larger than container div 640px wide then add class="img-fluid".

Context behind this is to ensure that images in a redactor field scale to fit their container size. but only images that are too big.

Thanks

mmikkel commented 1 year ago

Nope, sorry. That would require some kind of closure support in order to evaluate each node/image, which Retcon currently doesn't have.