How to minify HTML with CSS and Javascript?

后端 未结 4 2314
野性不改
野性不改 2021-02-14 19:55

I have a .html document with CSS and Javascript inside of document (no external files). Is there some online tool that would minify document and Javasc

4条回答
  •  情话喂你
    2021-02-14 20:29

    Closure compiler has been correctly recommended for JS; but not many are aware of Google's Closure stylesheets. One of the closure stylesheets features is renaming, where

    
    

    Lorem ipsum

    Lorem ipsum

    would become

    
    

    Lorem ipsum

    Lorem ipsum

    There'll be further minification too; and given the fact that OP indicates all resources are included into the html, this may end up saving quite a bit in traffic overhead.

    NB: if you inspect any Google search results page, you'll see their class and ID names are almost never longer than 4 random characters

提交回复
热议问题