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

Add deg and fr as exceptions for 0 value unit omission #2578

Merged
merged 3 commits into from Sep 1, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/visitor/compiler.js
Expand Up @@ -413,8 +413,8 @@ Compiler.prototype.visitUnit = function(unit){

// Compress
if (this.compress) {
// Always return '0' unless the unit is a percentage or time
if ('%' != type && 's' != type && 'ms' != type && 0 == n) return '0';
// Always return '0' unless the unit is a percentage, time, degree or fraction
if ('%' != type && 's' != type && 'ms' != type && 'deg' != type && 'fr' != type && 0 == n) return '0';
iChenLei marked this conversation as resolved.
Show resolved Hide resolved
// Omit leading '0' on floats
if (float && n < 1 && n > -1) {
return n.toString().replace('0.', '.') + type;
Expand Down