Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
How to Compress CSS File using PHP
WhatsApp
Bhushan Singh
Jan 15
2015
2.1
k
0
0
compress.zip
<?php
header(
'Content-type: text/css'
);
ob_start(
"compress"
);
function
compress(
$buffer
) {
$buffer
= preg_replace(
'!/\*[^*]*\*+([^/][^*]*\*+)*/!'
,
''
,
$buffer
);
$buffer
=
str_replace
(
array
(
"\r\n"
,
"\r"
,
"\n"
,
"\t"
,
' '
,
' '
,
' '
),
''
,
$buffer
);
return
$buffer
;
}
/* your css files */
include
(
'style.css'
);
include
(
'css/style.css'
);
?>
compress css file using php
css
php
Up Next
How to Compress CSS File using PHP