If there are tools around to minify css and js, why create more overhead calling a php script to do the job on the fly ?
Cheers
holo
2009/7/23 Yaroslav Vorozhko <vorozhko@gmail.com>
Andrew Pace пишет:
Hi all,Hi Andrew, i am also using combine.php, but in different way.
Thank you in advance for your help. I am trying to use a nice compression file for compressing CSS and Javascript files using .htaccess and a combine.php script. My current .htaccess looks like:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ – [NC,L]
RewriteRule ^.*$ /index.php [NC,L]
RewriteRule ^css/(.*\.css) /combine.php?type=css&files=$1
RewriteRule ^js/(.*\.js) /combine.php?type=javascript&files=$1
my file structure is:
/index.php
/js/(javascript files)
/css/(css files)
/cache/(caching files)
As you can see, the bottom two lines are the lines of the .htaccess are different than the recommended Zend Framework .htaccess.
In the non-ZF environment, the following .htaccess is recommended:
RewriteEngine On
RewriteBase /
RewriteRule ^css/(.*\.css) /combine.php?type=css&files=$1
RewriteRule ^javascript/(.*\.js) /combine.php?type=javascript&files=$1
Unfortunately, the .htaccess I am currently using isn't working right. The files are not being created. Any ideas?
I have copied and pasted the combine.php script below, as it is a useful resource (more useful if I get it working right :) haha).
Thanks,
Andrew
PS: If you have better methods of compressing CSS and JS files, let me know.
I put it in my header file
<script type="text/javascript" src="/combine.php?type=javascript&files=jquery-php/jquery.form.js,jquery-php/jquery.php.pack.js"></script>
combine.php placed at the document root and no .htaccess changes.
--
Thanks,
Yaroslav Vorozhko, Software Engeneer, Consultant
Skype: yarik0083 AIM: yarik0083 ICQ: 148966172
My blog: http://pro100pro.com
没有评论:
发表评论