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

[Feature Request]: postcss-normalize-whitespace should fold whitespace within var() #1457

Open
1 task
nex3 opened this issue Nov 28, 2022 · 1 comment
Open
1 task

Comments

@nex3
Copy link
Contributor

nex3 commented Nov 28, 2022

What should be improved?

Currently, postcss-normalize-whitespace doesn't compress whitespace at all within var() function calls. For example, var( --foo ) is emitted as-is rather than as var(--foo) or var( --foo ).

Describe the solution you would like

Within a normal property, whitespace before the first comma in var() should be removed completely and whitespace after the first comma should be folded down to a single space or removed depending on the context of the var(). For example:

/* input */
a {
  b: var(
    --foo
  );
}
/* output */
a{b:var(--foo)}

Within a custom property, since it may be interpreted by JavaScript rather than CSS (see #1456), whitespace should be folded down to the smallest form that produces an equivalent serialization: a single space. For example:

/* input */
a {
  --b: var(
    --foo
  );
}
/* output */
a{--b: var( --foo )}

Possible alternatives

No response

Additional context

N/A

Are you willing to work on this?

  • Yes, I would like to help
@ludofischer
Copy link
Collaborator

There was a commit in 2019 that disabled minification of white space inside of var() on purpose: #835. Myabe it was a bit overzealous.

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

No branches or pull requests

2 participants