margin.js 580 B

123456789101112131415161718192021
  1. var OptimizationLevel = require('../../../options/optimization-level').OptimizationLevel;
  2. var plugin = {
  3. level1: {
  4. property: function margin(_rule, property, options) {
  5. var values = property.value;
  6. if (!options.level[OptimizationLevel.One].replaceMultipleZeros) {
  7. return;
  8. }
  9. // remove multiple zeros
  10. if (values.length == 4 && values[0][1] === '0' && values[1][1] === '0' && values[2][1] === '0' && values[3][1] === '0') {
  11. property.value.splice(1);
  12. property.dirty = true;
  13. }
  14. }
  15. }
  16. };
  17. module.exports = plugin;