1

LESS code

.foo {
  background-size: 200px; //for old browsers
  background-size: cover;
}

CSS expected

.foo {
  background-size: 200px; 
  background-size: cover;
}

but less.js remove the first background-size property in compiled CSS file.

yulanggong
  • 1,348
  • 2
  • 9
  • 12
  • 1
    Less (atleast as at v1.7.5) would not remove the first setting. Are you using any other options during compilation like compress etc? Even `--clean-css` doesn't seem to b removing it. – Harry Dec 18 '14 at 11:11
  • 1
    Only `--clean-css="--advanced"` will remove such properties (so I'm afraid if you use that you have to turn it off in this case). – seven-phases-max Dec 19 '14 at 03:07

1 Answers1

1

AS already pointed out by @seven-phases-max clean-css removes these properties.

Notice that the --advanced has been set by default. You should use the --skip-advanced option to prevent your double properties from being removed.

According to https://github.com/less/less-plugin-clean-css the advanced option has been set to false by default.

lessc foo.less outputs:

.foo {
  background-size: 200px;
  background-size: cover;
}

lessc --clean-css foo.less outputs:

.foo{background-size:200px;background-size:cover}

lessc --clean-css="advanced" foo.less outputs:

 .foo{background-size:cover}

Alternatively you could run lessc -x foo.less which also outputs:

.foo{background-size:200px;background-size:cover}
Bass Jobsen
  • 48,736
  • 16
  • 143
  • 224