在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:jenstornell/tiny-html-minifier开源软件地址:https://github.com/jenstornell/tiny-html-minifier开源编程语言:PHP 80.7%开源软件介绍:Tiny Html MinifierIn short
Details - What the minifier does
Install & usage1. DownloadZIP Download Composer You can install it with Composer as well. 2. Add the code<?php
require 'tiny-html-minifier.php';
echo TinyMinify::html($html); Before / afterBefore<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<link href="http://example.com/style.css" rel="stylesheet" />
<link rel="icon" href="http://example.com/favicon.png" />
<title>Tiny Html Minifier</title>
</head>
<body class="body">
<div class="main-wrap">
<main>
<textarea>
Some text
with newlines
and some spaces
</textarea>
<div class="test">
<p>This text</p>
<p>should not</p>
<p>wrap on multiple lines</p>
</div>
</main>
</div>
<script>
console.log('Script tags are not minified');
console.log('This is inside a script tag');
</script></body>
</html> After<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><link href="http://example.com/style.css" rel="stylesheet"><link rel="icon" href="http://example.com/favicon.png"><title>Tiny Html Minifier</title></head> <body class="body"><div class="main-wrap"> <main> <textarea>
Some text
with newlines
and some spaces
</textarea> <div class="test"> <p>This text</p> <p>should not</p> <p>wrap on multiple lines</p> </div> </main> </div> <script>
console.log('Script tags are not minified');
console.log('This is inside a script tag');
</script></body></html> Options<?php
require 'tiny-html-minifier.php';
echo TinyMinify::html($html, $options = [
'collapse_whitespace' => false,
'disable_comments' => false,
]); collapse_whitespaceNot collapsedSpaces are preserved (except for most elements within <ul><li> <a href="#"> My link </a></li><li> <a href="#"> My link </a></li> </ul> CollapsedSpaces are collapsed. The text inside the element is still untouched. Set this value to <ul><li><a href="#">My link</a></li><li><a href="#">My link</a></li></ul> Requirements
DisclaimerThis plugin is provided "as is" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please create a new issue. LicenseIt is discouraged to use this plugin in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech. DonateIf you want to make a donation, you can do that by sending any amount https://www.paypal.me/DevoneraAB Credits |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论