Skip to content
This repository has been archived by the owner on Feb 1, 2020. It is now read-only.

FullHuman/purgecss-from-js-experimental

Repository files navigation

Purgecss-from-js

Build Status CircleCi dependencies Status devDependencies Status Codacy Badge Codacy Badge npm license

Get the selectors of a JS file.
This is an experimental js extractor for purgecss. It uses prepack to partially evaluate the javascript code.

Install

npm i -D purgecss-from-js

Usage

Use with Purgecss

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

Use alone

import purgeHtml from "purgecss-from-js"
import fs from "fs"

const htmlContent = fs.readFileSync("index.js")
const htmlSelectors = purgeHtml.extract(htmlContent)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published