<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          DropCSS無用 CSS 樣式清理工具

          聯合創(chuàng)作 · 2023-09-19 20:07

          DropCSS 是一個用來清理無用 CSS 的小工具,它根據 HTML 和 CSS 作為輸入并返回那些有用到的 CSS 信息。

          使用方法:

          const dropcss = require('dropcss');
          
          let html = `
              <html>
                  <head></head>
                  <body>
                      <p>Hello World!</p>
                  </body>
              </html>
          `;
          
          let css = `
              .card {
                padding: 8px;
              }
          
              p:hover a:first-child {
                color: red;
              }
          `;
          
          const whitelist = /#foo|\.bar/;
          
          let dropped = new Set();
          
          // returns { css }
          let cleaned = dropcss({
              html,
              css,
              shouldDrop: (sel) => {
                  if (whitelist.test(sel))
                      return false;
                  else {
                      dropped.add(sel);
                      return true;
                  }
              },
          });
          
          console.log(cleaned.css);
          
          console.log(dropped);

           

          瀏覽 28
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  国产成人视频九色91 | 国产伦精品一区二区三区成人片 | 国产精品V无码A片在线看吃奶 | JiZZ性欧美191看片 | 日本2区在线观看 |