Wednesday, November 6, 2013

Re: CakePHP 1.3 - Plugin asset loading - override Core.php compression rewrite

My current workaround is to load the plugin assets as elements. 
I've placed them in the following path "/plugin_name/views/elements/css/", name them in the following format: "filename.css.ctp" and then call them from the view(s) using the following:

<?php echo $this->element('css/filename.css'); ?>

This allows me to keep all the plugin assets within the plugin directory so that it is completely separate from the main application.


On Tuesday, October 29, 2013 10:48:47 AM UTC-4, Jas3n wrote:

I'm working with an existing CakePHP (ver. 1.3) application.  The main application utilizes CSS and JS compression via the /config/core.php file.  My project is to develop proprietary functionality into this application which I'm integrating as a CakePHP plugin.  Now there have been very few hitches while developing as a Plugin, but the issue below is one that I haven't been able to locate a solution for.

Since the compression config option is enabled in the main CakePHP core.php file, anytime I try to load CSS or JS within the plugin files to it's internal plugin assets location (/app/plugins/plugin_name/webroot/) it's automatically rewriting the folder to the cached folder "/plugin_name/webroot/ccss" or "/plugin_name/webroot/cjs" as it's supposed to for the main application.  This is the case regardless if I load via the cake helpers or using standard tagging.

Now I do not have any issues loading plugin image assets using the helper and the plugin path "/plugin_name/img/".  So, I can only assume that this is all related to the rewriting of the CSS and JS paths for the compression option.

So, is there a way to override the path rewriting for the plugin assets?  
Can my plugin define it's own config to compress its CSS and JS files separately (this would be nice to implement later on, but not necessary)?
Am I just completely off-base with my approach to this situation altogether, lol?

I would like to keep all the plugin files (including the assets) inside the plugin folder for numerous reasons.  Therefore, I'd like to avoid the alternative solution that would require files to be placed in the main application (not inside the plugin folder) if at all possible.

Thanks in advance for your responses!

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: