genCleanCSS method
- Contexts context,
- Output output
clean-css output
Implementation
void genCleanCSS(Contexts context, Output output) {
final double value = fround(context, this.value, cleanCss.precision);
var strValue = numToString(value); // 10.0 -> '10'
if (value != 0 && value < 0.000001 && value > -0.000001) {
// would be output 1e-6 etc.
strValue = value.toStringAsFixed(20).replaceFirst(RegExp(r'0+$'), '');
}
if (value == 0 && (unit.isLength(context) || unit.isAngle(context))) {
output.add(strValue);
return;
}
if (value > 0 && value < 1) strValue = strValue.substring(1); // 0.5
if (value < 0 && value > -1) strValue = '-${strValue.substring(2)}'; // -0.5
output.add(strValue);
unit.genCSS(context, output);
}