cupools / pxrem-loader

Transforming css from px to rem, base on pxrem
1 stars 0 forks source link

option "filter" can't work with vue-loader #2

Open yinxin630 opened 7 years ago

yinxin630 commented 7 years ago

In vue-loader. It will use JSON.stringify convert options to string. "filter" with regexp type will be filter: {}. And with function type will remove it.

cupools commented 7 years ago

Emmmmm... It seems vue-loader use JSON.stringify to parse option from object to query for its template. I'll follow up later and maybe you can try postcss-loader and pxrem first. See vue-loader with postcss.

And if you have some good ideas to resolve the question, PR is welcomed 🙂

yinxin630 commented 7 years ago

Let the filter accept the string type parameter. In the loader to detect whether the string type. Yes, then turn it into a regexp. This can solve the problem. Do you think this is a good idea?

cupools commented 7 years ago

Yes it works. But I prefer to use filter as function instead of regex. Regex cannot resolve the scene when I need to filter a pack of selectors, such as .should-use-px__xxxx, and function works well.