How to use the purgecss.defaultOptions function in purgecss

To help you get started, we’ve selected a few purgecss examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FullHuman / purgecss / packages / postcss-purgecss / lib / postcss-purgecss.js View on Github external
return async function(s, t) {
    const r = new purgecss.PurgeCSS(),
      o = { ...purgecss.defaultOptions, ...e };
    r.options = o;
    const { content: c, extractors: n } = o,
      u = c.filter(e => "string" == typeof e),
      p = c.filter(e => "object" == typeof e),
      i = await r.extractSelectorsFromFiles(u, n),
      l = r.extractSelectorsFromString(p, n),
      g = purgecss.mergeExtractorSelectors(i, l);
    r.walkThroughCSS(s, g),
      r.options.fontFace && r.removeUnusedFontFaces(),
      r.options.keyframes && r.removeUnusedKeyframes(),
      r.options.rejected &&
        r.selectorsRemoved.size > 0 &&
        (t.messages.push({
          type: "purgecss",
          plugin: "postcss-purgecss",
          text: `purging ${

purgecss

Remove unused css selectors

MIT
Latest version published 1 month ago

Package Health Score

95 / 100
Full package analysis