mirror of
https://github.com/danog/dart-sass.git
synced 2024-11-27 04:34:59 +01:00
Add unit(), unitless().
This commit is contained in:
parent
138bb6bace
commit
4a42f948f9
@ -816,6 +816,16 @@ void defineCoreFunctions(Environment environment) {
|
||||
assert(value is SassString);
|
||||
return new SassString("string");
|
||||
});
|
||||
|
||||
environment.defineFunction("unit", r"$number", (arguments) {
|
||||
var number = arguments[0].assertNumber("number");
|
||||
return new SassString(number.unitString, quotes: true);
|
||||
});
|
||||
|
||||
environment.defineFunction("unitless", r"$number", (arguments) {
|
||||
var number = arguments[0].assertNumber("number");
|
||||
return new SassBoolean(!number.hasUnits);
|
||||
});
|
||||
}
|
||||
|
||||
num _percentageOrUnitless(SassNumber number, num max, String name) {
|
||||
|
Loading…
Reference in New Issue
Block a user