JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6721
  • Score
    100M100P100Q140631F
  • License MIT

Html extractor for purgecss - get all selectors from a html file

Package Exports

  • purgecss-from-html

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (purgecss-from-html) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Purgecss-from-html

Build Status CircleCi dependencies Status devDependencies Status Codacy Badge npm license

Get the selectors of an html file.

Install

npm i -D purgecss-from-html

Usage

Use with Purgecss

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

Use alone

import purgeHtml from "purgecss-from-html"
import fs from "fs"

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