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 warning instead of purgecss messages when rejected: true to make messages show in console #1230

Open
ElectronicRU opened this issue Mar 13, 2024 · 2 comments

Comments

@ElectronicRU
Copy link

rejected: true flag is supposed to provide developer feedback, showing the rejected classes at build time. However, the custom message type this plugin is using isn't recognized by anything and is left for the void. Adding the messages as warnings would allow them to show on PostCSS / Webpack + PostCSS console to be reviewed by the developer.

@ivanbacher
Copy link

As a workaround you can use postcss-reporter

const purge = purgecss({
      content: ['./src/**/*.html'],
      rejected: true,
      variables: true
    })

    postcssLoader.options.postcssOptions.plugins.push(purge)

    const reporter = postcssRepoter({
      clearMessages: true,
      filter: () => true
    })

    postcssLoader.options.postcssOptions.plugins.push(reporter)

@ElectronicRU
Copy link
Author

Thank you! That solves my usecase, perhaps the package could be mentioned in the PostCSS plugin docs?

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

No branches or pull requests

2 participants