Skip to content

Instantly share code, notes, and snippets.

@Dianoga
Created May 14, 2014 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dianoga/2f88b3ea8ff15a8d4319 to your computer and use it in GitHub Desktop.
Save Dianoga/2f88b3ea8ff15a8d4319 to your computer and use it in GitHub Desktop.
Codekit hook to concatenate templates into html file
php -r '
$filename = "index2.html";
$file = file_get_contents($filename);
$views = str_replace("</script>", "</script>\n", `cat views/*`);
$find = "/(<!--StartTemplates-->)(.*)(<!--EndTemplates)/s";
$replace = "$1\n{{templates}}\n$3";
$file = preg_replace($find, $replace, $file);
$file = str_replace("{{templates}}", $views, $file);
file_put_contents($filename, $file);
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment