Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS attributes starting with Hyphens #40

Open
david-gottschalk opened this issue May 17, 2022 · 1 comment
Open

CSS attributes starting with Hyphens #40

david-gottschalk opened this issue May 17, 2022 · 1 comment

Comments

@david-gottschalk
Copy link

Heyo,
today I wanted to add some Custom CSS properties to my code and noticed that I wasn't able to produce the leading double hyphen, e.g., --outline-color with a camelCased attribute name. Any Ideas how to get this to work?
I saw mention of auto prefixing certain CSS attributes in the future-enhancements section at the bottom of Hyperscript.jl. Would this fall into this category?

Cheers

@algunion
Copy link
Contributor

Right now you are forced to write m("div","test"; Symbol("-OutlineColor") => "blue") in order to get <div --outline-color="blue">test</div>. However, m("div","test"; Symbol("--outline-color") => "blue") will produce the same thing.

This behavior is explained by the kebab function: kebab(camel::String) = join(islowercase(c) || isnumeric(c) || c == '-' ? c : '-' * lowercase(c) for c in camel) which runs on the attribute names. You can easily fork the package and reimplement the kebab function to meet your needs and run add yourforkedrepo to install the new package version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants