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
3k stars 405 forks source link

about the compile range #8

Closed wangzhenxi closed 5 years ago

wangzhenxi commented 6 years ago

I want the plugin just compile the folder './src', do not compile the folder './node_modules', because my ui component is not use same reference dimension, how should I do ?

chernobelenkiy commented 5 years ago

@Joshwoooooooooooooooooooooooooooooooong we've added exclude option ( thanks to @msidolphin ), where you can add paths as RegExp you want to exclude. For example, in your postcss.config.js:

module.exports = {
  plugins: {
    ...
    'postcss-px-to-viewport': {
      exclude: [/node_modules/]
    }
  }
}
fengyun2 commented 5 years ago

How to filter out an npm package, such as react-responsive-carousel?

KODerFunk commented 5 years ago

@fengyun2 may be something like

module.exports = {
  plugins: {
    ...
    'postcss-px-to-viewport': {
      exclude: [/node_modules\/(?!react\-responsive\-carousel)/]
    }
  }
}
kid1412621 commented 4 years ago

@chernobelenkiy is there any way to exclude one line in css? like adding /* none */ comment or something?