Neolithic Programming Machine

    purgecss-from-svelte

    2.0.2 • Public • Published

    purgecss-from-svelte

    Build Status CircleCi dependencies Status Codacy Badge npm license

    Get the selectors of an Svelte3 file.

    Install

    npm i -D purgecss-from-svelte
    

    Usage

    Use with Purgecss - PostCSS

    import Purgecss from "purgecss";
    import PurgeSvelte from "purgecss-from-svelte";
     
    const options = {
      content: ["./src/**/*.svelte"],
      extractors: [
        {
          extractor: PurgeSvelte,
          extensions: ["svelte"]
        }
      ]
    };
     
    /* Purgecss */
    const purgecss = new Purgecss(options);
    const result = purgecss.purge();
     
    /* PostCSS */
    {
      plugins: [require("@fullhuman/postcss-purgecss")(options)];
    }

    Use alone

    import PurgeSvelte from "purgecss-from-svelte";
    import fs from "fs";
     
    const htmlContent = fs.readFileSync("index.html");
    const selectors = PurgeSvelte.extract(htmlContent);

    Install

    npm i purgecss-from-svelte

    DownloadsWeekly Downloads

    457

    Version

    2.0.2

    License

    MIT

    Unpacked Size

    231 kB

    Total Files

    18

    Last publish

    Collaborators

    • langbamit