oceanwind icon indicating copy to clipboard operation
oceanwind copied to clipboard

Add an extension mechanism for utility classes

Open bebraw opened this issue 5 years ago • 2 comments

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.

bebraw avatar Sep 13 '20 11:09 bebraw

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.

lukejacksonn avatar Sep 13 '20 23:09 lukejacksonn

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.

bebraw avatar Sep 14 '20 06:09 bebraw