Your web browser is out of date. Update your browser for more security, speed and the best experience on this site.

Update your browser

May 13, 2020 • By Jake Dohm

Styling Redactor Output with Retcon (and Tailwind)

It's not rare to be working with a rich text field in Craft CMS and want to style some elements of the output without creating classes. This is especially true when you're working with Utility CSS frameworks like Tailwind CSS so you're not writing custom classes very often.

Thanks to Retcon, this is easy! In this video we'll look at how to replace and style elements using the Retcon plugin for Craft CMS.

      <div class="content">
  {{ entry.body|retcon([
    ['change', 'h1', 'h2'],
    ['attr', 'h2', { class: 'text-3xl font-bold mb-4' }],
    ['attr', 'p + p', { class: 'mt-4' }],
    ['attr', 'code', { class: 'bg-gray-300 rounded text-red-500 text-sm' }],
    ['attr', 'p > a', { class: 'text-blue-700' }]
  ]) }}

Further Reading

Feb 14, 2022 • By Garrett Winder

Should you choose Craft CMS or WordPress?

Content management systems (CMSs) allow you to create, edit and manage pages and content on your website with little need for ongoing development support. There are hundreds of CMSs available to you, but this article will focus on the two that we talk to clients the most about: Craft and WordPress. WordPress was one of the first CMSs. Initially bu…

Don’t let chaotic web projects get you down.

Get a web project — and a development process — that wows.

Ready to launch better web projects?
Download our free guide:

3 Reasons Most Digital Projects Get Derailed (And Why Yours Doesn't Have To)