Not sure if this is possible or just could not find the correct answer I was looking for.
ISSUE:
I have the site which uses various additional js scripts throughout the site. What I have is in my layouts is I load the absolute global required css and js and compress them.
Layouts/default.ctp
$this->Less->prepend(array('bootstrap.min.css', 'styles.less', 'admin.less', 'typography.less', 'jquery.fancybox.css'));
echo $this->Less->compile($options = array());
$this->Compressor->prepend_libs('js', array(
'jquery-1.9.1.min',
'bootstrap.min',
'admin',
'jquery.fancybox'));
echo $this->Compressor->scripts('js');
And then in my pages if I need an upload script or anything special I simply in that view add the css / js where needed on demand specific for that page. And it will create a single css / js files from the layout and view and cache it so it's only compile once or if changed
random_view.ctp
/*
additional js and css for page
*/
//$this->Less->add(array('uploader.css'));
$this->Compressor->add_libs('js', array(
'autoUploader',
'jquery.blockUI',
'jquery.form'));
PROBLEM:
I want to load 95% of these pages in the admin backend section via ajax.
But then none of the javascripting functionality works because it is not grabbing the javascript. The actual "base" page loads the initial css and js but loading new pages into the "content" area which need additional scripting will not work.
So if for example I click on my image gallery link it will load the page into the main section of the site. Uploader script is required for this page. Cluck upload => upLoader() is not a function. Because the required upload script is never actually pulled.
Any ideas guys? I cannot / do not want to add all the scripts on 1 page (size and conflict between scripts, so not really an option)
Thanks
Dave