threepointone/glamor

Plugin to change className?

Opened this issue · 7 comments

Hi, I am wondering if it possible to write a plugin that will change the selector that is appended to the elements when they are rendered.

Can you tell me your usecase?

I just found that I can use a label field in my styles but I was hoping to append a new class name to the element.

So instead of .css-label-hash I could end up with .label .css-hash. Is that currently possible?

Not exactly. You should experiment with the plugin arch, because it does let you rewrite the selector before being written. That said, I'd love to hear more about your actual usecase. Why do you need this?

What do you mean by plugin arch?
Edit: Oh architecture. I tried to write a plugin to do this and it would append a new class to the selector but it then would append the old selector to the elements.

could you tell me your usecase, what you're trying to achieve?

I am trying to achieve a classname that looks like .{label} .css-hash instead of .css-{label}-hash

I get that, am curious to know why and how and why you're using this, and whether there's an alternate solution?