mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-03 04:10:04 +02:00
update node modules
This commit is contained in:
25
node_modules/clean-css/lib/optimizer/level-2/properties/populate-components.js
generated
vendored
25
node_modules/clean-css/lib/optimizer/level-2/properties/populate-components.js
generated
vendored
@@ -1,5 +1,5 @@
|
||||
var compactable = require('../compactable');
|
||||
var InvalidPropertyError = require('../invalid-property-error');
|
||||
var configuration = require('../../configuration');
|
||||
var InvalidPropertyError = require('../../invalid-property-error');
|
||||
|
||||
function populateComponents(properties, validator, warnings) {
|
||||
var component;
|
||||
@@ -7,19 +7,24 @@ function populateComponents(properties, validator, warnings) {
|
||||
|
||||
for (var i = properties.length - 1; i >= 0; i--) {
|
||||
var property = properties[i];
|
||||
var descriptor = compactable[property.name];
|
||||
var descriptor = configuration[property.name];
|
||||
|
||||
if (!property.dynamic && descriptor && descriptor.shorthand) {
|
||||
if (onlyValueIsVariable(property, validator) || moreThanOneValueIsVariable(property, validator)) {
|
||||
property.optimizable = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (descriptor && descriptor.shorthand) {
|
||||
property.shorthand = true;
|
||||
property.dirty = true;
|
||||
|
||||
try {
|
||||
property.components = descriptor.breakUp(property, compactable, validator);
|
||||
property.components = descriptor.breakUp(property, configuration, validator);
|
||||
|
||||
if (descriptor.shorthandComponents) {
|
||||
for (j = 0, m = property.components.length; j < m; j++) {
|
||||
component = property.components[j];
|
||||
component.components = compactable[component.name].breakUp(component, compactable, validator);
|
||||
component.components = configuration[component.name].breakUp(component, configuration, validator);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -39,4 +44,12 @@ function populateComponents(properties, validator, warnings) {
|
||||
}
|
||||
}
|
||||
|
||||
function onlyValueIsVariable(property, validator) {
|
||||
return property.value.length == 1 && validator.isVariable(property.value[0][1]);
|
||||
}
|
||||
|
||||
function moreThanOneValueIsVariable(property, validator) {
|
||||
return property.value.length > 1 && property.value.filter(function (value) { return validator.isVariable(value[1]); }).length > 1;
|
||||
}
|
||||
|
||||
module.exports = populateComponents;
|
||||
|
Reference in New Issue
Block a user