cuth / postcss-pxtorem

Convert pixel units to rem (root em) units using PostCSS
MIT License
2.02k stars 174 forks source link

PX doesn't work with cssnano and postcss-calc #51

Open luksak opened 5 years ago

luksak commented 5 years ago

This is the error I get when using PX to ignore a property:


Message:
    Lexical error on line 1: Unrecognized text.

  Erroneous area:
1: 1PX + 0.3em
^..^
Details:
    hash: [object Object]
    postcssNode: padding:calc(1PX + 0.3em)
    fileName: /sass/styles.css
    domainEmitter: [object Object]
    domain: [object Object]
    domainThrown: false

Stack:
JisonLexerError: Lexical error on line 1: Unrecognized text.

  Erroneous area:
1: 1PX + 0.3em
^..^
    at /sass/styles.css:427:7
    at Object.parseError (/node_modules/postcss-calc/dist/parser.js:1164:15)
    at Object.lexer_parseError [as parseError] (/node_modules/postcss-calc/dist/parser.js:2297:44)
    at Object.lexer_next [as next] (/node_modules/postcss-calc/dist/parser.js:3292:22)
    at Object.lexer_fastLex [as fastLex] (/node_modules/postcss-calc/dist/parser.js:3367:18)
    at fastLex (/node_modules/postcss-calc/dist/parser.js:1567:27)
    at Parser.parse (/node_modules/postcss-calc/dist/parser.js:1641:30)
    at /node_modules/postcss-calc/dist/lib/transform.js:30:30
    at walk (/node_modules/postcss-value-parser/lib/walk.js:19:7)
    at ValueParser.walk (/node_modules/postcss-value-parser/lib/index.js:18:3)
    at transformValue (/node_modules/postcss-calc/dist/lib/transform.js:24:50)
    at _default (/node_modules/postcss-calc/dist/lib/transform.js:59:100)
    at /node_modules/postcss-calc/dist/index.js:25:51
    at /node_modules/postcss/lib/container.js:135:18
    at Rule.each (/node_modules/postcss/lib/container.js:101:16)
    at Rule.walk (/node_modules/postcss/lib/container.js:131:17)
    at /node_modules/postcss/lib/container.js:148:24```
y1324 commented 4 years ago

解决了吗???我也碰到这个问题了。打包出错,报语法错误

xxssww0258 commented 4 years ago

I have the same problem, currently using the selectorBlackList to filter

cuth commented 4 years ago

What if you tried running this plugin before running CSS nano?