|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
922 bytes
|
| Line | |
|---|
| 1 | var OptimizationLevel = require('../../../options/optimization-level').OptimizationLevel;
|
|---|
| 2 |
|
|---|
| 3 | function isNegative(value) {
|
|---|
| 4 | return value && value[1][0] == '-' && parseFloat(value[1]) < 0;
|
|---|
| 5 | }
|
|---|
| 6 |
|
|---|
| 7 | var 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 |
|
|---|
| 32 | module.exports = plugin;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.