From 86b7e75233b32e251edcf0910e7ea7daea4b1159 Mon Sep 17 00:00:00 2001 From: matyasrichter Date: Mon, 20 Jul 2020 19:49:47 +0200 Subject: Fixed an issue where in a gradient where the only non-percetage stop value would be zero, it would be marked as the max value and used in the denominator of a fraction. --- scss/extension/compass/gradients.py | 2 +- scss/tests/files/compass/gradients.css | 4 ++++ scss/tests/files/compass/gradients.scss | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/scss/extension/compass/gradients.py b/scss/extension/compass/gradients.py index 031fba2..15e1200 100644 --- a/scss/extension/compass/gradients.py +++ b/scss/extension/compass/gradients.py @@ -59,7 +59,7 @@ def __color_stops(percentages, *args): if prev_color: stops.append(None) stops = stops[:len(colors)] - if stops[0] is None: + if stops[0] is None or stops[0] == Number(0): stops[0] = Number(0, '%') if stops[-1] is None: stops[-1] = Number(100, '%') diff --git a/scss/tests/files/compass/gradients.css b/scss/tests/files/compass/gradients.css index f26dc7f..f0b75fd 100644 --- a/scss/tests/files/compass/gradients.css +++ b/scss/tests/files/compass/gradients.css @@ -82,3 +82,7 @@ .bg-linear-gradient-to { background: linear-gradient(to right, red, green); } + +.panel { + background-image: linear-gradient(to bottom, red, green); +} \ No newline at end of file diff --git a/scss/tests/files/compass/gradients.scss b/scss/tests/files/compass/gradients.scss index 1eba785..05b2c70 100644 --- a/scss/tests/files/compass/gradients.scss +++ b/scss/tests/files/compass/gradients.scss @@ -93,3 +93,8 @@ .bg-linear-gradient-to { background: linear-gradient(to right, red 0%, green 100%); } + +// Issue #404 +.panel { + background-image: linear-gradient(to bottom, red 0, green 100%); +} -- cgit v1.2.1 From 7d0490e09c0d0baa15b91cf172b1ba4d1ee4b187 Mon Sep 17 00:00:00 2001 From: matyasrichter Date: Mon, 20 Jul 2020 19:52:20 +0200 Subject: Added end-of-file newline. --- scss/tests/files/compass/gradients.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scss/tests/files/compass/gradients.css b/scss/tests/files/compass/gradients.css index f0b75fd..0dd99ee 100644 --- a/scss/tests/files/compass/gradients.css +++ b/scss/tests/files/compass/gradients.css @@ -85,4 +85,4 @@ .panel { background-image: linear-gradient(to bottom, red, green); -} \ No newline at end of file +} -- cgit v1.2.1