Although not intended, the minification profess can make code more difficult for humans to read, which is why minification can also been seen as light weight obfuscation. The core benefit to smaller files is that they require less bandwidth and are faster for the client to download. The end result is a new file which is smaller in size to the original, yet identical from a machine perspective. Thanks to StyleCI for the simple but powerfull code style check.Minification refers to the process of removing all unnecessary characters from a file while leaving the core functionality of the code in tact. Thanks to Travis CI for being the most awesome, easiest continous integration tool out there! Thanks to IntelliJ as they make the best IDEs for PHP and they gave me an open source license for PhpStorm! Thanks to GitHub (Microsoft) for hosting the code and a good infrastructure including Issues-Managment, etc. vendor/bin/phpunitįor support and donations please visit Github | Issues | PayPal | Patreon.įor status updates and release announcements please visit Releases | Twitter | Patreon.įor professional support please contact me. composer require voku/html-minĢ) The tests can be executed by running this command from the root directory. PS: you can use the "nocompress"-tag to keep the html e.g.: "\n foobar \n" Unit Testġ) Composer is a prerequisite for running the tests. $htmlMin->doRemoveOmittedHtmlTags() // remove ommitted html tags e.g. $htmlMin->doRemoveOmittedQuotes() // remove quotes e.g. $htmlMin->doRemoveSpacesBetweenTags() // remove more (aggressive) spaces in the dom (disabled by default) ![]() ![]() $htmlMin->doSortHtmlAttributes() // sort html-attributes, for better gzip results (depends on "doOptimizeAttributes(true)") $htmlMin->doSortCssClassNames() // sort css-class-names, for better gzip results (depends on "doOptimizeAttributes(true)") $htmlMin->doRemoveValueFromEmptyInput() // remove 'value=""' from empty (depends on "doOptimizeAttributes(true)") $htmlMin->doRemoveEmptyAttributes() // remove some empty attributes (depends on "doOptimizeAttributes(true)") $htmlMin->doRemoveDefaultTypeFromButton() // remove type="submit" from button tags $htmlMin->doRemoveDefaultMediaTypeFromStyleAndLinkTag() // remove "media="all" from all links and styles $htmlMin->doRemoveDeprecatedTypeFromStyleAndLinkTag() // remove "type=text/css" from all links and styles $htmlMin->doRemoveDeprecatedTypeFromStylesheetLink() // remove "type=text/css" for css links (depends on "doOptimizeAttributes(true)") $htmlMin->doRemoveDeprecatedTypeFromScriptTag() // remove deprecated script-mime-types (depends on "doOptimizeAttributes(true)") $htmlMin->doRemoveDeprecatedScriptCharsetAttribute() // remove deprecated charset-attribute - the browser will use the charset from the HTTP-Header, anyway (depends on "doOptimizeAttributes(true)") $htmlMin->doRemoveDeprecatedAnchorName() // remove deprecated anchor-jump (depends on "doOptimizeAttributes(true)") $htmlMin->doRemoveDefaultAttributes() // remove defaults (depends on "doOptimizeAttributes(true)" | disabled by default) $htmlMin->doMakeSameDomainsLinksRelative() // make some links relative, by removing the domain from attributes $htmlMin->doKeepHttpAndHttpsPrefixOnExternalAttributes() // keep "http:"- and "https:"-prefix for all external links $htmlMin->doRemoveHttpsPrefixFromAttributes() // remove optional "https:"-prefix from attributes (depends on "doOptimizeAttributes(true)") $htmlMin->doRemoveHttpPrefixFromAttributes() // remove optional "http:"-prefix from attributes (depends on "doOptimizeAttributes(true)") $htmlMin->doOptimizeAttributes() // optimize html attributes (depends on "doOptimizeViaHtmlDomParser(true)") $htmlMin->doRemoveWhitespaceAroundTags() // remove whitespace around tags (depends on "doOptimizeViaHtmlDomParser(true)") $htmlMin->doSumUpWhitespace() // sum-up extra whitespace from the Dom (depends on "doOptimizeViaHtmlDomParser(true)") $htmlMin->doRemoveComments() // remove default HTML comments (depends on "doOptimizeViaHtmlDomParser(true)") $htmlMin->doOptimizeViaHtmlDomParser() // optimize html via "HtmlDomParser()" * Protected HTML (inline css / inline js / conditional comments) are still protected, It will also prepare the HTML for better gzip results, by re-ranging (sort alphabetical) attributes and css-class-names. As a result pages become smaller in size and load faster. HtmlMin is a fast and very easy to use PHP library that minifies given HTML5 source by removing extra whitespaces, comments and other unneeded characters without breaking the content structure. ![]() :clamp: HtmlMin: HTML Compressor and Minifier for PHP
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |