Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = function Declaration(node) {
// ignore custom properties (variables) since its names are case sensitive
if (resolve(node.property).custom) {
return;
}
// .a { PROPERTY: value }
// ->
// .a { property: value }
node.property = node.property.toLowerCase();
};
enter: declaration => {
if (csstree.property(declaration.property).name === 'font-family') {
const name = utils.unquoteString(
csstree.generate(declaration.value)
);
// was this @font-face used?
if (!activeFontFamilyNames.has(name)) {
atruleList.remove(atruleItem);
}
}
}
});
enter: declaration => {
const name = csstree.property(declaration.property).name
if (name === 'font-family') {
const familyName = decodeFontName(declaration.value)
// was this @font-face used?
if (!fontNameValues.has(familyName)) {
debuglog('drop unused @font-face: ' + familyName)
used = false
}
} else if (name === 'src') {
hasSrc = true
}
}
})
module.exports = function compressValue(node) {
if (!this.declaration) {
return;
}
var property = resolveName(this.declaration.property);
if (handlers.hasOwnProperty(property.basename)) {
handlers[property.basename](node);
}
};
function needless(props, declaration, fingerprints) {
var property = resolveProperty(declaration.property);
if (NEEDLESS_TABLE.hasOwnProperty(property.basename)) {
var table = NEEDLESS_TABLE[property.basename];
for (var i = 0; i < table.length; i++) {
var ppre = getPropertyFingerprint(property.prefix + table[i], declaration, fingerprints);
var prev = props.hasOwnProperty(ppre) ? props[ppre] : null;
if (prev && (!declaration.important || prev.item.data.important)) {
return prev;
}
}
}
}
function getPropertyFingerprint(propertyName, declaration, fingerprints) {
var realName = resolveProperty(propertyName).basename;
if (realName === 'background') {
return propertyName + ':' + generate(declaration.value);
}
var declarationId = declaration.id;
var fingerprint = fingerprints[declarationId];
if (!fingerprint) {
switch (declaration.value.type) {
case 'Value':
var vendorId = '';
var iehack = '';
var special = {};
var raw = false;