Urara-Blog/node_modules/.pnpm-store/v3/files/38/b7e7b14d9e668c97313b0a93b9bb9e531cb3e980e5c27a740de897270e5a5731670cac190dd2ca8418ee30b650c56e1b3680785bc108437a0c72a823821f43
2022-08-14 01:14:53 +08:00

36 lines
1.1 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var lexer = require('css-tree').lexer;
var packNumber = require('./Number').pack;
var blacklist = new Set([
// see https://github.com/jakubpawlowicz/clean-css/issues/957
'width',
'min-width',
'max-width',
'height',
'min-height',
'max-height',
// issue #410: Dont remove units in flex-basis value for (-ms-)flex shorthand
// issue #362: shouldn't remove unit in -ms-flex since it breaks flex in IE10/11
// issue #200: shouldn't remove unit in flex since it breaks flex in IE10/11
'flex',
'-ms-flex'
]);
module.exports = function compressPercentage(node, item) {
node.value = packNumber(node.value, item);
if (node.value === '0' && this.declaration && !blacklist.has(this.declaration.property)) {
// try to convert a number
item.data = {
type: 'Number',
loc: node.loc,
value: node.value
};
// that's ok only when new value matches on length
if (!lexer.matchDeclaration(this.declaration).isType(item.data, 'length')) {
// otherwise rollback changes
item.data = node;
}
}
};