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

Support for pseudo tags #383

Open
RiksGitHubThing opened this issue Apr 22, 2021 · 6 comments
Open

Support for pseudo tags #383

RiksGitHubThing opened this issue Apr 22, 2021 · 6 comments

Comments

@RiksGitHubThing
Copy link

Not sure if this is by design, or a configuration option, but something like

<style> a:hover { text-decoration: none; } </style>

doesn't seem to get inlined

@jrit
Copy link
Collaborator

jrit commented Apr 22, 2021

There isn't a way I know of to inline a hover state that is only active on hover. Do you know of one?

@Yankovsky
Copy link

@jrit What do you think about automatically adding !important to every pseudo selector?
Suppose I have html:

<style>
.myClass {
  color: red;
}
.myClass:hover {
  color: green;
}
</style>
<h1 class="myClass">My Title</h1>

and juice outputs:

<style>
.myClass:hover {
  color: green;
}
</style>
<h1 class="myClass" style="color: red;">My Title</h1>

Obviously, hover won't work because inline style has higher specificity and I have to manually put !important to every pseudo class rule. Same goes to media queries.

I understand that such option is a breaking change for existing codebases, but it could be disabled by default.

@jrit
Copy link
Collaborator

jrit commented Jul 21, 2021

That seems like a very reasonable transform to add and likely default that option to OFF to avoid breaking a bunch of people's styles on the update. If anyone wants to submit a PR, seems relatively straightforward to tackle

@Yankovsky
Copy link

@jrit I am very happy that you like the idea.
I can try, but I am unfamiliar with codebase.

@Yankovsky
Copy link

@jrit can you suggest a name for such option?

@jrit
Copy link
Collaborator

jrit commented Jul 21, 2021

addImportantToPseudoClasses ? I'm also not very active in the codebase the last few years, there is very good test coverage so don't be afraid to dive in

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

3 participants