Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add possibility to pass cssnano options when using extract #159

Open
vladshcherbin opened this issue Mar 10, 2019 · 5 comments
Open

Add possibility to pass cssnano options when using extract #159

vladshcherbin opened this issue Mar 10, 2019 · 5 comments

Comments

@vladshcherbin
Copy link

Hey,

In cssnano there are presets which can be used - https://cssnano.co/guides/presets.

I wanted to use them and tried the following config, but it didn't work.

postcss({
  extract: true,
  modules: true,
  namedExports: true,
  minimize: {
    preset: ['default', {
      discardComments: {
        removeAll: true
      }
    }]
  }
})

It seems like when extract is true, options are not passed to cssnano. When not extracted, options are passed.

It would be great have this in extract mode too.

rollup - 1.2.2
rollup-plugin-postcss - 2.0.3

@enure
Copy link

enure commented Mar 12, 2019

Just my two cents, but I think cssnano should be removed altogether and developers can just add it to their rollup build as needed. It's super simple to add it as a dependency for your project, and then you can use it according to their docs rather than integrating through this module. Further, upgrading cssnano is then separated from this module.

@vladshcherbin
Copy link
Author

@enure postcss with modules has all class names, used in files. They can be passed to cssnano and unused classes will be removed from extracted css file. I'm not sure if this is possible with a standalone plugin.

@enure
Copy link

enure commented Mar 12, 2019

Gotcha, that makes sense.

@alisonailea
Copy link

alisonailea commented Mar 20, 2019

This is a complete blocker for us right now as we need to extract the css but svgo is trying to compile our already compiled datauri encoded svgs and throwing an error.

rollup - 1.7.0
rollup-plugin-postcss - 2.0.3

@getup8
Copy link

getup8 commented Dec 29, 2021

This seems to work now? I think this can be closed perhaps?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants