Skip to content

Commit 234480a

Browse files
committed
Add support for complex units in CSS
1 parent 4747063 commit 234480a

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 1.96.0
2+
3+
* Allow numbers with complex units (more than one numerator unit or more than
4+
zero denominator units) to be emitted to CSS. These are now emitted as
5+
`calc()` expressions, which now support complex units in plain CSS.
6+
17
## 1.95.0
28

39
* Add support for the [CSS-style `if()` function]. In addition to supporting the

lib/src/visitor/serialize.dart

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -526,9 +526,6 @@ final class _SerializeVisitor
526526

527527
void _writeCalculationValue(Object value) {
528528
switch (value) {
529-
case SassNumber(hasComplexUnits: true) when !_inspect:
530-
throw SassScriptException("$value isn't a valid CSS value.");
531-
532529
case SassNumber(value: double(isFinite: false)):
533530
switch (value.value) {
534531
case double.infinity:
@@ -1121,10 +1118,6 @@ final class _SerializeVisitor
11211118
}
11221119

11231120
if (value.hasComplexUnits) {
1124-
if (!_inspect) {
1125-
throw SassScriptException("$value isn't a valid CSS value.");
1126-
}
1127-
11281121
visitCalculation(SassCalculation.unsimplified('calc', [value]));
11291122
} else {
11301123
_writeNumber(value.value);

pkg/sass_api/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 17.1.0
2+
3+
* No user-visible changes.
4+
15
## 17.0.0
26

37
* Rename the old `IfExpression` class to `LegacyIfExpression`.

pkg/sass_api/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ name: sass_api
22
# Note: Every time we add a new Sass AST node, we need to bump the *major*
33
# version because it's a breaking change for anyone who's implementing the
44
# visitor interface(s).
5-
version: 17.0.0
5+
version: 17.1.0
66
description: Additional APIs for Dart Sass.
77
homepage: https://github.com/sass/dart-sass
88

99
environment:
1010
sdk: ">=3.6.0 <4.0.0"
1111

1212
dependencies:
13-
sass: 1.95.0
13+
sass: 1.96.0
1414

1515
dev_dependencies:
1616
dartdoc: ">=8.0.14 <10.0.0"

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: sass
2-
version: 1.95.0
2+
version: 1.96.0
33
description: A Sass implementation in Dart.
44
homepage: https://github.com/sass/dart-sass
55

0 commit comments

Comments
 (0)