I have been developing some projects with ExtJs for a while and also created some plubg-ins and extensions for these projects. Recently, I found out that I have so many *.js and *.css codes and they are somehow too fat for some slow band width users. Well, I decided to google some solutions to minify my js and css codes. Luckily, I found
minify and I am loving it. However, most of my ExtJs plug-ins and extensions are called by
Ext.require and it is somehow complicated to override the
Ext.Loader.require so I googled again... Ha... the answer came up from
here (Using .htaccess and RewriteRule? for Minify).
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteRule ^(.*\.(css|js).*)$ min/f=%{REQUEST_URI} [L,NC]
The
original post is just rewrite the file name but I need full path.
Well, just replace
$1 to
%{REQUEST_URI} and put the .htaccess file under the
Ext.ux path.
Then job done.
So when you call:
Ext.require([
'Ext.ux.SimpleIFrame',
'Ext.ux.PreviewPlugin',
'Ext.ux.GMapPanel'
]);
The Apache server redirects the JS script URL and the
minify class process it.
Have a try and your will love it...