songsiqi / px2rem-postcss

Postcss version of px2rem.
270 stars 49 forks source link

增加parse参数,不改变postcss的ast结构 #35

Open wkstudy opened 2 years ago

wkstudy commented 2 years ago

详细起因经过点这里:https://github.com/vitejs/vite/pull/7186 这里是简要描述:

  1. postcss的parse一般会接受参数opts,并且生成的ast的某些值依赖opts https://github.com/postcss/postcss/blob/24f2efc9a36d31c7a0cdf884804d3cfaea024be2/lib/parse.js#L7
  2. 我们这里没有传opts,导致ast少了属性input.file,而我在用的vite里的vite-url-plugin插件强依赖了这个属性导致最终打包出问题
  3. 我觉得ast还是不应该受到影响的,所以做了这个修改

感谢大佬