#!/usr/bin/php
]+dcwebui.css[^>]*>~', '', $html_content);
// Embed JS into HTML file
$js_file = file_get_contents('clientpack/dcwebui.min.js');
$html_content = preg_replace('~', $html_content);
// Embed socketio into HTML file
$SIO_NAME = 'socket.io-1.7.2.js';
$sio_file = file_get_contents('clientpack/'.$SIO_NAME);
$html_content = preg_replace('~', $html_content);
// Minify the combined file
file_put_contents('clientpack/index.htm', $html_content);
`html-minifier --collapse-whitespace -o clientpack/index.min.htm clientpack/index.htm`;
// Clean up files
`rm clientpack/{index.htm,dcwebui{.min,}.js,dcwebui{.min,}.css}`;
unlink('clientpack/'.$SIO_NAME);
rename('clientpack/index.min.htm', 'clientpack/index.htm');