csstools / postcss-normalize

Use the parts of normalize.css (or sanitize.css) you need from your browserslist
Creative Commons Zero v1.0 Universal
816 stars 40 forks source link

Anyway to have single insertion across multiple compiles? #18

Closed jackysee closed 7 years ago

jackysee commented 7 years ago

I'm using vue, configured the vue-loader to render the .vue file's <style> section to use postcss.

As each component get its own <style>, this plugin would inject itself multiple times. I would like to have a configuration such that it only inject when @import-normalize is found. So that I can control it to appear only on top-level component. Like:

plugins : [ 
//...
    require('postcss-normalize')({ injectByImportOnly: true })
]

I can workaround it by download the normalize.css and use postcss-import, but it that way I cannot benefit from the browserlist to output a smaller file to my targeted browser.

madeleineostoja commented 7 years ago

See https://github.com/jonathantneal/postcss-normalize/issues/14

madeleineostoja commented 7 years ago

@jonathantneal Perhaps docs need to be clearer on this?

jonathantneal commented 7 years ago

@jackysee, that’s a great idea, and I may release a new major version that makes injection by @import-normalize the default.

jonathantneal commented 7 years ago

Done via v4.0.0. Published!