csstools / postcss-nesting

Nest style rules inside each other

Home Page:https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Trailing semicolon cause some plugin's translate failed

Akimyou opened this issue · comments

commented

I use postcss-nesting => px2rem. This px2rem plugin use semicolon to determine how to translate px unit.

For example

Source

.app {
  height: 100px; /*no*/
  & .hello {
    height: 100px; /*no*/
    height: 'PX2REM NO BUG';
  }
}

After postcss-nesting

.app {
  height: 100px /*no*/
}

.app .hello {
  height: 100px;

  /*no*/
  height: 'PX2REM NO BUG'; }

Than px2rem cannot resolve height: 100px /*no*/( semicolon missing ). After px2rem

.app {
  height: 1.333333rem;  /* incorrect */
}

.app .hello {
  height: 100px;
  height: 'PX2REM NO BUG';
}

https://github.com/songsiqi/px2rem

Do you have some ideal for resolve this problem?

Thank You! 39

If the original declaration had a semicolon, it should be preserved. If it is not, this is a bug in PostCSS, and I would file an issue there. I’m very sorry for the late response.