[OpenLayers-Users] Minifying scripts

Xavier Mamano (jorix) xavier.mamano at gmail.com
Wed Nov 7 14:19:02 PST 2012


Hi,

The key to reducing more the code is to compress only the necessary
components (using simple mode of Closure by build.py). This is what has been
done in OpenLayers.mobile.js 375Kb and OpenLayers.light.js 280Kb
(OpenLayers.js 722Kb) 

Download the zip of 2.12 and see the folder /duild/, you will find
"mobile.cfg" and "light.cfg", edit one to create "your-configuration.cfg"
file and use it with "python build.py -c closure your-configuration.cfg
../OpenLayers-custom.js", and then use "OpenLayers-custom.js". That's all.

See https://github.com/openlayers/openlayers/blob/master/build/README.txt !!

NOTE: "api" is the last stable release, so 2.12.


appleton wrote
> Thanks for the tips.
> 
> I'm actually accessing the openlayers library directly from my script like
> this:

> 
> I assume that is allowed?
> 
> So I'm just needing to minify my own script.
> 
> The advanced mode of Closure seems to change other things like "document"
> so I gave up on it and used the simple mode instead. I've also written a
> quick SED script to shorten global variables before feeding to closure -
> together that seems to do all the minifying I need at present.
> 
> _______________________________________________
> Users mailing list

> Users at .osgeo

> http://lists.osgeo.org/mailman/listinfo/openlayers-users





--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Minifying-scripts-tp5013815p5014669.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list