Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php function to minify javascript and css

$css = '';
$root = $_SERVER['DOCUMENT_ROOT'].'/css/'; //directory where the css lives
$files = explode(',',$_SERVER['QUERY_STRING']);
if(sizeof($files))
{
	foreach($files as $file)
	{
		$css.= (is_file($root.$file.'.css') ? file_get_contents($root.$file.'.css') : '');
	}
}
return str_replace('; ',';',str_replace(' }','}',str_replace('{ ','{',str_replace(array("
","
","
","	",'  ','    ','    '),"",preg_replace('!/*[^*]**+([^/][^*]**+)*/!','',$css)))));
Comment

PREVIOUS NEXT
Code Example
Php :: how change resource route parameters lravel 
Php :: How to Get Radio Button Value in PHP Without Submit 
Php :: laravel where and blade 
Php :: oops concepts in php 
Php :: run composer with specific php version 
Php :: php creating a subdomain automatically in cpanel 
Php :: how to change validation message in laravel 
Php :: laravel download file change name 
Php :: php strict mopde 
Php :: install all php extensions ubuntu 20.04 
Php :: A Livewire component was not found 
Php :: edd login page wordpress 
Php :: php increment variable 
Php :: wordpress highlight text excerpt 
Php :: php remove non printable characters 
Php :: php capture include 
Php :: laravel dirty words check 
Php :: audio validation in jquery validation 
Php :: laravel update only changed fields 
Php :: get last name user 
Php :: close route in laravel 
Php :: check if config exist laravel 
Php :: php pagination ellipsis 
Php :: bd sms gateway, laravel sms gateway, sms sending library, bd sms, sms gateway 
Php :: send mail infinityfree phpmailer 
Php :: laravel get list of files in directory 
Php :: php session destroy not working 
Php :: convertir date php en français 
Php :: laravel group concat values showing duplicate 
Php :: laravel display category post by slug 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =