HTML Compressor
Phan Nhật Chánh - Official website

HTML Compressor

   Jan 19, 2015   
Báo lỗi bài viết×
Bài viết: HTML Compressor
Một công cụ mini làm giảm kích thước mã HTML, JavaScript và CSS của bạn, làm cho trang web của bạn tải nhanh hơn
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>HTML Compressor</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<style>
*{margin:0;padding:0}
body{
background-color:white;
text-align:center;
padding:50px 50px
}
textarea{ margin:10px auto; }
button{ cursor:pointer }
</style>
</head>
<body>
<a href="http://wwww.nhatchanh.info"><h1>Mini HTML Compressor</h1></a>
<textarea class="form-control" id="inp" rows="15" spellcheck="false" placeholder=""></textarea>
<button type="submit" class="btn btn-primary" id="out"><i class="glyphicon glyphicon-repeat"></i> Compress HTML</button>
<script>
(function(){
var inp=document.getElementById('inp'),
out=document.getElementById('out');
function compress(){
var
res=inp.value;
res=res.replace(/(>)?\s+/g,"$1 ");
res=res.replace(/([\t\n\s\r]+)</g,"<");
inp.value=res;
inp.focus();
inp.select()
}out.onclick=compress
})();
</script>
</body>
</html>
Xem thêm
http://htmlcompressor.com
http://jsbeautifier.org

Post a Comment