slime icon indicating copy to clipboard operation
slime copied to clipboard

Add Tailwind JIT Support

Open johns10 opened this issue 4 years ago • 2 comments

Hello! I recently attempted a tailwind JIT setup on my phoenix project, and found that it didn't work. Based on what I've read, this isn't surprising, as there's a very simple regex that's used to purge template files, and it just doesn't pick up the slim classes. Has anyone had luck setting this up, and has guidance?

One quick and dirty solution I'm considering is pre-compiling the slim templates to html using a post-save hook, and using those on the product. Would love to hear other people's feedback on this.

johns10 avatar Nov 10 '21 08:11 johns10

@johns10 I've been looking into this too – It looks like the slim template language, which slime is based on, has been upgraded to support tailwind: https://github.com/slim-template/slim/pull/841 so maybe this project can take some inspiration from there.

Tailwind allows you to configure the defaultExtractor ? function, which is a good place to start for getting it to work with slim / leex / sheex templates: https://purgecss.com/configuration.html

There's also some dscussion on how to make Tailwind play nicely with haml, which inspired slim, which inspired slime:

https://stackoverflow.com/questions/56365824/slim-templates-and-tailwindcss-use-in-class-declaration

I think that Tailwind gives you enough options that it can be configured to work with slime in its current form – Please let us know how your efforts progress!

tensiondriven avatar Feb 09 '22 15:02 tensiondriven

Will do!

johns10 avatar Feb 20 '22 20:02 johns10