xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

autoprefixer: ignore next not work bug All In One

autoprefixer: ignore next not work bug All In One

webpack 打包后,样式部分丢失

可能原因

  1. Node.js 升级 v8.9 => v14.16
  2. node-sass 换成 dart-sass
  3. 更新后 CI docker 有缓存
  4. ...

bug ❌

/* autoprefixer: ignore next */ ❌ not work any more

.multText-inline {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    /* autoprefixer: ignore next */
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

solution ✅

已验证 OK

.multText-inline {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    /*! autoprefixer: off */
    -webkit-box-orient: vertical;
    /* autoprefixer: on */
    -webkit-line-clamp: 3;
}

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

或 ???❌


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

源码


const OLD_LINEAR = /(^|[^-])linear-gradient\(\s*(top|left|right|bottom)/i
const OLD_RADIAL = /(^|[^-])radial-gradient\(\s*\d+(\w*|%)\s+\d+(\w*|%)\s*,/i
const IGNORE_NEXT = /(!\s*)?autoprefixer:\s*ignore\s+next/i
const GRID_REGEX = /(!\s*)?autoprefixer\s*grid:\s*(on|off|(no-)?autoplace)/i

https://github.com/postcss/autoprefixer/blob/69ed8a0d35cd3d8445c1a713f63ccfc32db29bb9/lib/processor.js#L8

https://github.com/postcss/autoprefixer/blob/69ed8a0d35cd3d8445c1a713f63ccfc32db29bb9/lib/processor.js#L551

https://github.com/postcss/autoprefixer/blob/69ed8a0d35cd3d8445c1a713f63ccfc32db29bb9/lib/processor.js#L665

Autoprefixer error

Second Autoprefixer control comment was ignored. Autoprefixer applies control comment to whole block, not to next rules.

二合一 ???


.mult-lines-text-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    /*! autoprefixer: off */
+  /* autoprefixer: ignore next */
    -webkit-box-orient: vertical;
    /* autoprefixer: on */
    -webkit-line-clamp: 3;
}

https://gist.github.com/xgqfrms/f0e0c6f7c8dd55c7a1fa1c1cb51f2d7a

refs

https://stackoverflow.com/questions/56105499/attribute-webkit-box-orient-in-css-not-working-when-build-in-vuejs

https://github.com/postcss/autoprefixer/issues/1220

https://juejin.cn/post/6844903848599896072



©xgqfrms 2012-2020

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2022-01-26 21:24  xgqfrms  阅读(307)  评论(2编辑  收藏  举报