autoprefixer icon indicating copy to clipboard operation
autoprefixer copied to clipboard

Certain CSS lines are ignored

Open GiDW opened this issue 9 years ago • 12 comments

Hi

I have found an issue with the latest version (6.7.7) of this plugin.

My project uses Gulp for build automation and I use the gulp-autoprefixer package, which requires this package. When using the latest version 6.7.7 of autoprefixer, the CSS property "-webkit-box-orient" is being left out. No matter where I place the property, it is not present in the final CSS file.

Version 6.4.0 does not have this issue.

By switching between version 6.4.0 and 6.7.7, I am able to reproduce this reliably.

Kind regards

GiDW avatar Mar 15 '17 09:03 GiDW

  1. Please use gulp-postcss as official way to use Autoprefixer.

ai avatar Mar 15 '17 09:03 ai

  1. If you need old webkit flexbox, set old Safari into browserslist config. Autoprefixer remove this prefix, because modern (default browsers list) Safari doesn't need it anymore.

https://github.com/ai/browserslist

ai avatar Mar 15 '17 09:03 ai

Currently my browserslist is ['last 2 Chrome versions', 'last 3 iOS versions'].

I will look into using postcss.

Thanks for the quick reply!

GiDW avatar Mar 15 '17 09:03 GiDW

@HandySam https://github.com/postcss/autoprefixer#gulp

You already uses PostCSS, it just hidden inside gulp-autoprefixer.

ai avatar Mar 15 '17 09:03 ai

@HandySam according Can I Use last 3 iOS versions doesn’t need -webkit- for flexbox http://caniuse.com/#feat=flexbox

ai avatar Mar 15 '17 09:03 ai

I am using the old flexbox display: -webkit-box to have -webkit-line-clamp, which needs -webkit-box-orient: vertical;. This is why a regular flexbox is not desired in this specific use-case.

GiDW avatar Mar 15 '17 09:03 GiDW

@HandySam could you show your input CSS, output CSS and expected output CSS. I think I missed how you can use display: -webkit-box — in Autoprefixer you should not write prefixes.

ai avatar Mar 15 '17 09:03 ai

.some-class {
  position: relative;
  display: -webkit-box;
  width: 100%;
  vertical-align: middle;
  text-align: center;
  white-space: normal;
  word-wrap: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

To my understanding, it is not possible to use line-clamp with a regular flexbox.

I will create a small project in which I can reproduce the issue later today.

GiDW avatar Mar 15 '17 10:03 GiDW

But it will be Safari only way :-/ There is a few solution here https://css-tricks.com/line-clampin/

Writing prefixes manually is very very bad. You get short term benefits with a lot of problems in long term distance (like current Autoprefixer problems).

ai avatar Mar 15 '17 10:03 ai

If you want to continue using your short-term ignore-all-non-webkit-browsers way, add old Safari to your browserslist config.

But it will be much better to use any other standard method.

ai avatar Mar 15 '17 10:03 ai

Yes I know, it is not really a nice solution, but for my current project (iOS and Chrome only) it works. I will look into a better approach later.

Thanks for the help!

GiDW avatar Mar 15 '17 10:03 GiDW

Possibly helpful for anyone reading up on this thread and problem, least intrusive option to prevent the removal of the line in question is to just disable the autoprefixer for this line/section

    /* autoprefixer: off */
    -webkit-box-orient: vertical;
    /* autoprefixer: on */

Lars-Weber avatar Apr 27 '17 14:04 Lars-Weber