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

[pug-lexer] Tailwind classes support #3373

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

FlameArt
Copy link

Support for Tailwind classes syntax like .lg:w-[555px], .hover:border etc
Test added

The only confilct I saw: colon : is used for block expansion, but only with space symbol between a blocks, Tailwind no need spaces in class names, so i just add negative lookahead for colon-space combination in regexp

@rollingversions
Copy link

There is no change log for this pull request yet.

Create a changelog

@byre54
Copy link

byre54 commented May 24, 2022

is this work already ? I uses Tailwind with Pug FYI, and it's kinda nice to have this.

@webdiscus
Copy link

@FlameArt

you can use Tailwind classes in class attribute:

//- instead of this non-standard syntax
a.focus:border.lg:w-[555px]
//- can be used clear standard syntax
a(class="focus:border lg:w-[555px]")

P.S.: Please don't pollute Pug with tailwind's non-standard syntax ;-)
Please note that several IDE linters give display errors and this syntax will not be supported in IDEs.

@Shinigami92
Copy link
Contributor

@FlameArt

you can use Tailwind classes in class attribute:

//- instead of this non-standard syntax
a.focus:border.lg:w-[555px]
//- can be used clear standard syntax
a(class="focus:border lg:w-[555px]")

P.S.: Please don't pollute Pug with tailwind's non-standard syntax ;-) Please note that several IDE linters give display errors and this syntax will not be supported in IDEs.

I think you see it from the wrong perspective 🤔
It's not supported, because it was not added / handled by pug
But this repo IS pug and this PR adds support for it!
Linter, formatter and syntax highlighter would need to be updated accordingly to support this new handling of classes after this PR gets released

@kaceo
Copy link

kaceo commented Feb 4, 2023

P.S.: Please don't pollute Pug with tailwind's non-standard syntax

I think you see it from the wrong perspective 🤔

Hear hear. Pug has not progressed feature-wise in past year but CSS frameworks like Tailwindcss has.

Pug needs to evolve:

  • support extended class names including symbols like colon, slash, percent.
  • expect tags to have dozens of class literals, and these may spread over multiple lines
  • support a flexible multi-line quoting strategy for strings.
  • also allow attributes to have multiple same names, don't treat them as errors, just warnings.

@orenmizr
Copy link

orenmizr commented Oct 6, 2023

status on this ?
by a pug/vue user :/

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

Successfully merging this pull request may close these issues.

6 participants