source: imaps-frontend/node_modules/clean-css/lib/optimizer/level-1/property-optimizers/padding.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 5 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 922 bytes
Line 
1var OptimizationLevel = require('../../../options/optimization-level').OptimizationLevel;
2
3function isNegative(value) {
4 return value && value[1][0] == '-' && parseFloat(value[1]) < 0;
5}
6
7var plugin = {
8 level1: {
9 property: function padding(_rule, property, options) {
10 var values = property.value;
11
12 // remove multiple zeros
13 if (values.length == 4 && values[0][1] === '0' && values[1][1] === '0' && values[2][1] === '0' && values[3][1] === '0') {
14 property.value.splice(1);
15 property.dirty = true;
16 }
17
18 // remove negative paddings
19 if (options.level[OptimizationLevel.One].removeNegativePaddings
20 && (
21 isNegative(property.value[0])
22 || isNegative(property.value[1])
23 || isNegative(property.value[2])
24 || isNegative(property.value[3])
25 )) {
26 property.unused = true;
27 }
28 }
29 }
30};
31
32module.exports = plugin;
Note: See TracBrowser for help on using the repository browser.