Skip to content
This repository has been archived by the owner on Mar 29, 2024. It is now read-only.

How to use? #1

Open
borispov opened this issue Nov 4, 2019 · 1 comment
Open

How to use? #1

borispov opened this issue Nov 4, 2019 · 1 comment

Comments

@borispov
Copy link

borispov commented Nov 4, 2019

If I use tailwind and postcss, should I just use it like I'd use the regular purgecss module?

@Ffloriel
Copy link
Member

Yes, it was meant to be use the same way for javascript files. @alinaish would be able to tell you more about it but the goal is to be more accurate than the default extractor.

import Purgecss from 'purgecss'
import purgeFromJs from 'purgecss-from-js'
const purgeCss = new Purgecss({
  content: ['**/*.html', '**/*.js'],
  css: ['**/*.css'],
  extractors: [
    {
      extractor: purgeFromJs,
      extensions: ['js']
    }
  ]
})
const result = purgeCss.purge()

It is not widely used yet so let us know how it goes :).

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

No branches or pull requests

2 participants