slim-template / slim

Slim is a template language whose goal is to reduce the syntax to the essential parts without becoming cryptic.

Home Page:https://slim-template.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extract all used css classes (as far as possible) via AST/parser for tailwind's purgecss

emilebosch opened this issue · comments

Heya! Would love to find some way to extract all the CSS classes for tailwind from the SLIM files. Tailwind uses this to purgecss the tailwind css file. Any ideas how one might achieve this?

I was thinking about using the parser and then applying some magic? Any ideas/pointers on how together all the css classes form slim files would be appreciated <3

I use Slim with Roda framework (similar to Sinatra) and the standard purge settings for TailwindCSS 2.0 work just fine in terms of extracting used classes inside my Slim views. Below you will find settings inside my tailwind.config.js file.

The purge setting tells PurgeCSS to look and extract Tailwind classes that it finds inside all files of type js,rb,slim,erb,html located inside the ./app directory in the root of my project. The **/* basically tells it to look recursively for those file types inside any nested/subdirectiores under ./app. I hope this helps!

module.exports = {
  mode: 'jit',
  purge: [
    './app/**/*.{js,rb,slim,erb,html}',
  ],
  darkMode: false, // or 'media' or 'class'
  plugins: [],
}