Script dibawah ini berfungsi untuk menghilangkan spasi pada file css anda agar lebih ringan ketika di load
header('Content-type: text/css');
ob_start("compress");
function compress($buffer) {
/* remove comments */
$buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer);
/* remove tabs, spaces, newlines, etc. */
$buffer = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $buffer);
return $buffer;
}
/* your css files */
include('master.css');
include('typography.css');
include('grid.css');
include('print.css');
include('handheld.css');
ob_end_flush();
Simpan kode PHP diatas misalnya compress.php
Cara menggunakannya di html:
<html>
<head>
<link href=”compress.php” rel=”stylesheet” type=”text/css” />
</head>
<body>
</body>
(Visited 734 times, 1 visits today)
ini ditaruh dimana gan, kunjungan balik ia jangan lupa untuk follow back gan
Script diatas adalah code PHP gan. Script diatas bisa disimpan dalam 1 file php misalnya compress.php
Lalu di HTML agan masukkan di header. Misalnya:
<html>
<head>
<link href=”compress.php” rel=”stylesheet” type=”text/css” />
</head>
<body>
</body>
trimakasih. ngebantu sekali untuk mengkompress css atau js nya. hehe. lagi coba buat aplikasi soalnya jadi perlu banyak yg dikompress.