mmikkel / Retcon-Craft

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

Conditionally add css class? #45

Closed mark-chief closed 2 years ago

mark-chief commented 2 years 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 2 years ago

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