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

fix: handle 2 color-stop-length in linear-gradient #1215

Conversation

goulashsoup
Copy link
Contributor

fixes #1205

Copy link
Collaborator

@ludofischer ludofischer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider my review comment and run yarn fixlint to format the code so the linting step passes.

@@ -74,7 +74,9 @@ function optimise(decl) {
!isFinalStop &&
lastStop &&
lastStop.number === '0' &&
lastStop.unit.toLowerCase() !== 'deg'
lastStop.unit.toLowerCase() !== 'deg' &&
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to revert these changes and instead change line 63 to

if (arg.length !== 3) {

All of the existing processing assumes the one-stop syntax (it expects [something, space, something] as arg

Copy link
Contributor Author

@goulashsoup goulashsoup Oct 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then background:linear-gradient(#ffe500 0% 0%,#121 100%) => background:linear-gradient(#121) would be ignored but i think this is justified.

I change the code again today.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the code as you suggested now, the case i mentioned is unhandled.

@goulashsoup goulashsoup force-pushed the postcss-minify-gradients-2-color-stop-length branch 2 times, most recently from f208a95 to f2f12cc Compare October 28, 2021 08:50
@goulashsoup goulashsoup force-pushed the postcss-minify-gradients-2-color-stop-length branch from f2f12cc to ff8a9eb Compare October 28, 2021 08:54
@codecov-commenter
Copy link

Codecov Report

Merging #1215 (ff8a9eb) into master (a2cd55c) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1215   +/-   ##
=======================================
  Coverage   96.54%   96.54%           
=======================================
  Files         116      116           
  Lines        3614     3614           
  Branches     1064     1064           
=======================================
  Hits         3489     3489           
  Misses        117      117           
  Partials        8        8           
Impacted Files Coverage Δ
packages/postcss-minify-gradients/src/index.js 98.01% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a2cd55c...ff8a9eb. Read the comment docs.

Copy link
Collaborator

@ludofischer ludofischer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates!

@ludofischer ludofischer merged commit 8bb7ba6 into cssnano:master Oct 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants