<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>

          HtmlCompressorHTML 壓縮庫(kù)

          聯(lián)合創(chuàng)作 · 2023-09-21 23:21

          HtmlCompressor 是一個(gè) Java 類庫(kù),用來(lái)對(duì) HTML 內(nèi)容進(jìn)行壓縮。HtmlCompressor 會(huì)刪除 HTML 中無(wú)用的空格、空行、注釋等內(nèi)容。

          該項(xiàng)目還提供了 Maven 插件,詳情請(qǐng)看 https://github.com/alextunyk/htmlcompressor-maven-plugin

          示例代碼:

          HtmlCompressor compressor = new HtmlCompressor();
          
          compressor.setEnabled(true);                   //if false all compression is off (default is true)
          compressor.setRemoveComments(true);            //if false keeps HTML comments (default is true)
          compressor.setRemoveMultiSpaces(true);         //if false keeps multiple whitespace characters (default is true)
          compressor.setRemoveIntertagSpaces(true);      //removes iter-tag whitespace characters
          compressor.setRemoveQuotes(true);              //removes unnecessary tag attribute quotes
          compressor.setSimpleDoctype(true);             //simplify existing doctype
          compressor.setRemoveScriptAttributes(true);    //remove optional attributes from script tags
          compressor.setRemoveStyleAttributes(true);     //remove optional attributes from style tags
          compressor.setRemoveLinkAttributes(true);      //remove optional attributes from link tags
          compressor.setRemoveFormAttributes(true);      //remove optional attributes from form tags
          compressor.setRemoveInputAttributes(true);     //remove optional attributes from input tags
          compressor.setSimpleBooleanAttributes(true);   //remove values from boolean tag attributes
          compressor.setRemoveJavaScriptProtocol(true);  //remove "javascript:" from inline event handlers
          compressor.setRemoveHttpProtocol(true);        //replace "http://" with "http://" inside tag attributes
          compressor.setRemoveHttpsProtocol(true);       //replace "https://" with "http://" inside tag attributes
          compressor.setPreserveLineBreaks(true);        //preserves original line breaks
          compressor.setRemoveSurroundingSpaces("br,p"); //remove spaces around provided tags
          
          compressor.setCompressCss(true);               //compress inline css 
          compressor.setCompressJavaScript(true);        //compress inline javascript
          compressor.setYuiCssLineBreak(80);             //--line-break param for Yahoo YUI Compressor 
          compressor.setYuiJsDisableOptimizations(true); //--disable-optimizations param for Yahoo YUI Compressor 
          compressor.setYuiJsLineBreak(-1);              //--line-break param for Yahoo YUI Compressor 
          compressor.setYuiJsNoMunge(true);              //--nomunge param for Yahoo YUI Compressor 
          compressor.setYuiJsPreserveAllSemiColons(true);//--preserve-semi param for Yahoo YUI Compressor 
          
          //use Google Closure Compiler for javascript compression
          compressor.setJavaScriptCompressor(new ClosureJavaScriptCompressor(CompilationLevel.SIMPLE_OPTIMIZATIONS));
          
          //use your own implementation of css comressor
          compressor.setCssCompressor(new MyOwnCssCompressor());
          
          String compressedHtml = compressor.compress(html);
          瀏覽 24
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <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>
                  全部免费的毛片在线看 | 日韩欧美中文字幕在线观看 | 尻屄视频可以在线观看 | 亚洲精品三级 | 全部孕妇丰满孕妇孕交 |