多行文本省略号样式失效丢失,以及控制台显示autoprefixer警告'Autoprefixer applies control comment to whole block, not to next rules.'


  • 问题现象

  使用webpack压缩打包vue项目,遇到一个问题,文本多行显示省略号的关键css语句-webkit-box-orient: vertical;莫名其妙丢失失效了。查阅资料,有不少人提出在改样式前后添加注释(后处理程序):

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

  再次打包,发现样式恢复正常。然后控制台却多出一条警告:‘(Emitted value instead of an instance of Error) autoprefixer: \static\css\reset\index.css:99:3: Second Autoprefixer control comment was ignored. Autoprefixer applies control comment to whole block, not to next rules.’,这对于强迫症来说是极其难受的。

  • 原因

  正如警告中所说,以上的css处理语句控制的应该是整个css块,而不是在此之后的css。

  • 处理

  将此处修改为:

/*! autoprefixer: ignore next */
-webkit-box-orient: vertical;

  恢复正常。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM