threepointone/glamor

improve plugin system

Closed this issue · 5 comments

I have folks who want to be able to do this with the plugin system. It feels like what would really help with this is to be able to hook into the styles before the selector is generated and/or return more selector/style pairs from a plugin.

I'm usually wary of plugins that run before everything else, because that can usually be done on the consumer side. Consider the example you gave me, you could rewrite it as this

const Bordered = glamorous.div(
  {
    border: '1px solid',
  },
  props => glamor.css({
    '.ltr &': props,
    '.rtl &': rtlConvert(props),
  })
)

However, I see the value, and I'll definitely add it when I rewrite the plugin system, I hope the workaround above helps till then.

Adding to backburner and closing issue, will revisit on next major revision.

The idea was to allow a centrally-configured set of RTL transformations rather than having to modify every single component, so the workaround isn't really an option. Looking forward to seeing the next generation of plugin APIs. (In this case, all we'd really need is to be able to return an array of { selector, styles } objects instead of one.)

Noted. Another workaround could be to have a plugin system at glamorous' level that does this, and then when glamor gets the feature, you could just delegate to it.

Happy to look at a PR to add a plugin system to glamorous. I'm hesitant to do so though considering glamor already has one 🤔

aziz commented

I'm also highly interested in a plugin system, exactly for the RTL transformation reason.
And I'm not using the glamorous. So looking forward to the plugin system or at least built in RTL transformation using RTLCSS