lukejacksonn / oceanwind

Compiles tailwind shorthand into css at runtime. Succeeded by Twind.
https://twind.dev
264 stars 12 forks source link

Add an extension mechanism for utility classes #14

Open bebraw opened 3 years ago

bebraw commented 3 years ago

Likely there should be a way to add your own utilities to Oceanwind. I have a couple of project specific ones I would like to add there.

lukejacksonn commented 3 years ago

A plugin kind of mechanism would be nice. The cap directive was my first attempt at extending the Tailwind API but I just hard coded it. There needs to be a way of extending the switch statement essentially (but not actually).

I imagine you could probably extend the theme to have something like:

{
  plugins: {
    cap: (directive) => ...
  }
}

If no translation was found for a directive (it wasn't part of the core API), it would get passed to each function in plugins to see if they could resolve it.

bebraw commented 3 years ago

Yeah, sometimes what happens is that you end up with a small plugin core and then implement even the base functionality as plugins you can test in isolation.