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

Component generation with styles with attribute selectors does not work. #232

Closed
gunters63 opened this issue Apr 5, 2021 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@gunters63
Copy link
Contributor

gunters63 commented Apr 5, 2021

Given the following JSON input for component generation:

{
	".btn-disabled,.btn[disabled]": {
		"-TwBgOpacity":["1", "0.2"], 
		"backgroundColor":"hsla(var(--n,219 14% 28%)/var(--tw-bg-opacity))", 
		"-TwBorderOpacity":"0", 
		"-TwTextOpacity":["1", "0.2"], 
		"color":"hsla(var(--bc,215 28% 17%)/var(--tw-text-opacity))"
	}
}

the following markup:

<button disabled>BUTTON</button>

does not generate the expected style (This is the TailwindCSS generated style):

.btn-disabled,
.btn[disabled] {
	--tw-bg-opacity: 1;
	background-color: hsla(var(--n, 219 14% 28%)/var(--tw-bg-opacity));
	--tw-bg-opacity: 0.2;
	--tw-border-opacity: 0;
	--tw-text-opacity: 1;
	color: hsla(var(--bc, 215 28% 17%)/var(--tw-text-opacity));
	--tw-text-opacity: 0.2
}

In fact, nothing is generated, WindiCSS does not to seem to recognize the disabled attribute.

<button className="btn-disabled">BUTTON</button>

generates the following:

.btn-disabled {
  --tw-bg-opacity: 1;
  --tw-bg-opacity: 0.2;
  background-color: hsla(var(--n,219 14% 28%)/var(--tw-bg-opacity));
  --tw-border-opacity: 0;
  --tw-text-opacity: 1;
  --tw-text-opacity: 0.2;
  color: hsla(var(--bc,215 28% 17%)/var(--tw-text-opacity));
}

the attribute selector .btn[disabled] is missing.

@gunters63 gunters63 changed the title Component generation with styles with attribute selectors do not work. Component generation with styles with attribute selectors does not work. Apr 5, 2021
@gunters63
Copy link
Contributor Author

TailwindCSS and WindiCSS also differ in the order of the CSS variables (--tw-xxxx), I have to try out if this makes a difference

@antfu antfu added the bug Something isn't working label Apr 6, 2021
@antfu antfu closed this as completed in 71fd959 Apr 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants