<?php
/* 
= Return minified css or js file in production if it exists, else return the un-minified
* Version: 1.0
* URL: elbone.com.au
* Usage: <link rel="stylesheet" href="<?php elbone_res_files('bootstrap.css', 'bootstrap.min.css'); ?>">
*/

function elbone_res_files($script, $script_min = '') {
    
    // My localhost setup - use your IP address here
    $my_localhost = array('localhost', '127.0.0.1');

	// Localhost?
	$localhost = (!in_array($_SERVER['HTTP_HOST'], $my_localhost)) ? true : false;
	
	// File url - uyse yours here
	$url = get_bloginfo('template_directory').'/lib/';
	
	// The script
	$script = (!$localhost && strstr(current(get_headers($url.$script_min)), "200")) ? $script_min : $script;
	
    // Echo it
	echo $url.$script;
}

?>