1. <strong id="7actg"></strong>
    2. <table id="7actg"></table>

    3. <address id="7actg"></address>
      <address id="7actg"></address>
      1. <object id="7actg"><tt id="7actg"></tt></object>

        DropCSS無用 CSS 樣式清理工具

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

        DropCSS 是一個用來清理無用 CSS 的小工具,它根據(jù) 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
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

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

        手機掃一掃分享

        編輯 分享
        舉報
        1. <strong id="7actg"></strong>
        2. <table id="7actg"></table>

        3. <address id="7actg"></address>
          <address id="7actg"></address>
          1. <object id="7actg"><tt id="7actg"></tt></object>
            韩国免费一级a一片在线播放 | 亚洲永久网址 | 欧美一级特黄aaaaaaa什 | 男人天堂新地址 | 欧美视频在线观看不卡 | 国产精品中文字幕在线播放 | 久久国产影视 | 亚洲天堂性| 一级毛片成人免费看A | 国产免费一区二区 |