Skip to content

Option to override default extractor? #180

Closed
@adamwathan

Description

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!

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions