evrone / postcss-px-to-viewport

A plugin for PostCSS that generates viewport units (vw, vh, vmin, vmax) from pixel units. The best choice to create a scalable interface on different displays by one design size.
https://evrone.com/postcss-px-viewport
MIT License
2.99k stars 401 forks source link

feature: add path blacklist #99

Open kisnows opened 3 years ago

kisnows commented 3 years ago

add a feature, can't filter translate by path.

                pxtoviewport({
                 // import  css form node_modules/@alife/wap-union-xman will be ignore.
                  blacklistPath: ['node_modules/@alife/wap-union-xman'],
                  viewportWidth: postcss.viewportWidth || 750, // (Number) The width of the viewport.
                  viewportHeight: 1334, // (Number) The height of the viewport.
                  unitPrecision: 3, // (Number) The decimal numbers to allow the REM units to grow to.
                  viewportUnit: 'vw', // (String) Expected units.
                  selectorBlackList: [/^\.bc-/, /^\.wlkeeppx/, /^\.xman/], // (Array) The selectors to ignore and leave as px.
                  minPixelValue: 1, // (Number) Set the minimum pixel value to replace.
                  mediaQuery: true, // (Boolean) Allow px to be converted in media queries.
                })