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

Option to override default extractor? #180

Closed
adamwathan opened this issue Apr 11, 2019 · 1 comment
Closed

Option to override default extractor? #180

adamwathan opened this issue Apr 11, 2019 · 1 comment

Comments

@adamwathan
Copy link
Contributor

First of all thanks so much for continuing to maintain this amazing project, it is so valuable to everyone in the Tailwind CSS community!

Would you be open to a pull request that makes it possible to override the default extractor, something like this?

// postcss.config.js
module.exports = {
  plugins: [
    purgecss({
      content: ['./**/*.html'],
      defaultExtractor: content => content.match(/[A-Za-z0-9-_:/]+/g) || [],
    })
  ]
}

The motivation is to avoid having to list all of the extensions your custom extractor should match if all you are really trying to do is add some extra characters to the regular expression.

In a perfect world I would love to be able to just specify the pattern even:

// postcss.config.js
module.exports = {
  plugins: [
    purgecss({
      content: ['./**/*.html'],
      defaultExtractorPattern: /[A-Za-z0-9-_:/]+/g,
    })
  ]
}

Thanks again!

@Ffloriel
Copy link
Member

Hi,
Thanks, I'm happy to know it is useful 😊.
Yes, I think it could be valuable to have an option to override the default extractor.

// postcss.config.js
module.exports = {
  plugins: [
    purgecss({
      content: ['./**/*.html'],
      defaultExtractor: content => content.match(/[A-Za-z0-9-_:/]+/g) || [],
    })
  ]
}

I am definitely open to a pull request :)

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

2 participants