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

Width set with calc cut off in width style color shorthand properties #1053

Closed
yggg opened this issue Nov 26, 2018 · 1 comment
Closed

Width set with calc cut off in width style color shorthand properties #1053

yggg opened this issue Nov 26, 2018 · 1 comment
Labels

Comments

@yggg
Copy link

yggg commented Nov 26, 2018

Environment

  • clean-css version - 4.2.1:
  • node.js version - 10.13.0:
  • operating system: macOS 10.14

Configuration options

var CleanCSS = require('clean-css');
new CleanCSS({
  level: {
    2: { all: false },
  },
})

Input CSS

.width-style-color-props {
  border: calc(1px) solid blue;
  outline: calc(1px) solid blue;
}

Actual output CSS

.width-style-color-props {
  border: solid #00f;
  outline: #00f solid;
}

Expected output CSS

.width-style-color-props {
  border: calc(1px) solid #00f;
  outline: calc(1px) solid #00f;
}

_widthFilter which is used by widthStyleColor function to get width part, excludes calc with !validator.isDynamicUnit(value[1]) statement, for some reason.
https://github.com/jakubpawlowicz/clean-css/blob/887ac0e2d1f10e16663edf0719153f18597824d5/lib/optimizer/level-2/break-up.js#L61
Is it intentional? I believe it's a valid css since calc can be used wherever length values are allowed.

@yggg yggg changed the title Width set with calc cut off in width style color shorthand properties. Width set with calc cut off in width style color shorthand properties Nov 26, 2018
@jakubpawlowicz
Copy link
Collaborator

You were right @yggg, sorry it took me so long to fix it.

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

No branches or pull requests

2 participants