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

transition shorthand unit lost when level is 2 #1050

Closed
hsuanxyz opened this issue Sep 17, 2018 · 3 comments
Closed

transition shorthand unit lost when level is 2 #1050

hsuanxyz opened this issue Sep 17, 2018 · 3 comments
Labels

Comments

@hsuanxyz
Copy link

Precheck

  • Do a quick search and make sure a bug has not yet been reported;
  • do a quick check if the bug still exists in the latest patch version;
  • finally, be nice and have fun!

Environment

  • clean-css version: 4.2.x
  • node.js version: v10.0.0
  • operating system: darwin x64

Configuration options

var CleanCSS = require('clean-css');
var input = `
.a {
  transition: opacity .3s linear, height 0s ease .3s;
}

.b {
  transition: opacity .3s linear, height 1s ease .3s;
}
`;

var options = {
  compatibility: 'ie9',
  level        : 2,
  inline       : false,
  returnPromise: true,
  sourceMap    : true,
};

new CleanCSS(options).minify(input)
  .then(output => {
    console.log(output.styles)
  });

Input CSS

.a {
  transition: opacity .3s linear, height 0s ease .3s;
}

.b {
  transition: opacity .3s linear, height 1s ease .3s;
}

Actual output CSS

.a{transition:opacity .3s linear,height .3s}.b{transition:opacity .3s linear,height 1s .3s}

Expected output CSS

.a{transition:opacity .3s linear,height  0s ease .3s}.b{transition:opacity .3s linear,height 1s ease .3s}
@hsuanxyz
Copy link
Author

input

image

output

image

filipesilva added a commit to filipesilva/angular-cli that referenced this issue Oct 2, 2018
hsuanxyz added a commit to hsuanxyz/angular-cli that referenced this issue Oct 12, 2018
hsuanxyz added a commit to hsuanxyz/angular-cli that referenced this issue Oct 12, 2018
alexeagle pushed a commit to angular/angular-cli that referenced this issue Oct 18, 2018
alexeagle pushed a commit to angular/angular-cli that referenced this issue Oct 18, 2018
@emilemil1
Copy link

emilemil1 commented Dec 19, 2018

Still an issue with transition shorthands.

This:

.test {
    transition: opacity 0s 1s;
}
.test.active {
    transition: opacity 1s 0s;
}

Becomes this (formatted):

.test, .test.active {
    transition: opacity 1s
}

From what I can gather, the issue only seems to occur when one of the arguments (duration or delay) is 0s. What I guess is happening is that because 0s is the default for both duration and delay, clean-css incorrectly removes that part of the shorthand, leaving only the other number which is then interpreted as duration. This is fine if only duration is declared, but not if it's both duration and delay since that changes semantics (unless both are 0s).

@jovilog
Copy link

jovilog commented Jun 5, 2019

Any progress on this issue?

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

4 participants