Skip to content

Instantly share code, notes, and snippets.

@rynop
Created December 10, 2010 15:30
Show Gist options
  • Save rynop/736338 to your computer and use it in GitHub Desktop.
Save rynop/736338 to your computer and use it in GitHub Desktop.
patch for breaking up js,css,codeblock when debug > 0
86,89c86,104
< }
<
< if (Configure::read('debug') && $this->options['debug'] == false) {
< return join("\n\t", $this->View->__scripts);
---
> }
>
> //Allow breaking up of js,css,codeblock in your html when debug is > 0
> //Ex: putting 'css' in head and 'js','codeblock' at bottom before </body>
> if (Configure::read('debug') && $this->options['debug'] == false) {
> $scripts_for_layout = array();
> foreach ($this->View->__scripts as $resource) {
> foreach ($types as $type) {
> if($type=='css' || $type=='js') {
> if(stristr($resource,'.'.$type)) $scripts_for_layout[] = $resource;
> }
> elseif($type=='codeblock') {
> if(!stristr($resource,'.js') && !stristr($resource,'.css')){
> $scripts_for_layout[] = $resource;
> }
> }
> }
> }
> return join("\n\t", $scripts_for_layout);
129,131d143
< if (Configure::read('debug') && $this->options['debug'] == false) {
< return;
< }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment