开发者

Trying to properly setup minify php for multiple groups

Here is the situation:

Some pages on my site use different js files than other. For in开发者_JAVA技巧stance: Page A uses jquery and jqueryui Page B uses jquery, jqueryui and jquery validation Page C uses jquery, jqueryui, jquery qtip

Now I have created groups in minify's groupsConfig.php like this:

'mainjs' => array(
                '//ext/jquery/jquery-1.4.4.min.js',
                '//ext/jquery/ui/jquery-ui-1.8.6.min.js'
                ),
'pageA' = > array(
                '//ext/jquery/jquery-1.4.4.min.js',
                '//ext/jquery/ui/jquery-ui-1.8.6.min.js',
                '//ext/jquery/jquery-validation.js'
                ),

My question is..that if I get different pages to load different js groups doesn't that sort of defeat the purpose of caching it on the client?

For example one page might load like this /min/g=mainjs while the other one will load /min/g=pageA etc etc.


UPDATE: I may have found a concept for how it should work.. Please see here: http://www.mrclay.org/2008/09/19/minify-21-on-mrclayorg/#comment-101896

Any idea on how to accomplish what the commentator did?


You can use Google APIs for better caching and other good reasons.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script>


Well here is the work around I came up with.

1) I created a group called generaljs (for javascript) and a group called generalcss (for css) and basically have all the files I need across the entire site into that.

2) For other pages such as Page A and Page B and Page C I created respective groups for those called pageajs and pageacss

3) On pages where I don't need page A's javascript and css file I just loaded them at the end of body so it would be ready via cache when the visitor goes to Page A. Rinse and repeat for other pages as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜