Skip to content

Instantly share code, notes, and snippets.

@davemerwin
Created March 19, 2021 17:17
Show Gist options
  • Save davemerwin/9924eb59f6a96a1c218d3a2c666f4063 to your computer and use it in GitHub Desktop.
Save davemerwin/9924eb59f6a96a1c218d3a2c666f4063 to your computer and use it in GitHub Desktop.
Image Classes For Richtext Image in Wagtail with Tailwind
from django.utils.translation import gettext_lazy as _
from wagtail.images.formats import Format, register_image_format, unregister_image_format
unregister_image_format('fullwidth')
register_image_format(Format('fullwidth', _('Full width'), 'w-100 rounded-lg', 'width-800'))
unregister_image_format('left')
register_image_format(Format('left', _('Left-aligned'), 'w-1/2 float-left rounded-lg', 'width-800'))
unregister_image_format('right')
register_image_format(Format('right', _('Right-aligned'), 'w-1/2 float-right rounded-lg', 'width-800'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment