[OpenLayers-Dev] Closure Compiler for OpenLayers 3.x

Klokan Petr Přidal klokan at klokan.cz
Fri Dec 3 04:08:45 EST 2010

Hello Peter,

I have seen your ticket. OpenLayers 2.x can be compiled only with
SIMPLE OPTIMIZATION. Then the Closure Compiler is just another
minimizer, slightly better then JSMIN. No big deal, beside 20% smaller
file size for existing build process. ;-)

What I am suggesting with the blog post is to write the code of
OpenLayers 3.x in a way to allow ADVANCED_OPTIMIZATION of of the code.

This would bring:

- Much better code optimization - resulting in even smaller file size.
- Documentation with JSDoc Tags is validated and meaningful - code is
under better control
- Possibility to strip all unused parts of the OpenLayers library when
it is compiled together with the final application. No need to choose
in advance what functionality I want in the building profiles.
Dependencies are solved by the compiler automatically.
- Possibility to compile OpenLayers only for particular use - Mobile
WebKit browser, Quirks vs Standards mode, etc.
- Debugging with FireBug even for the compiled version of the source code.
- Generation of dynamically loadable modules, to speed up loading of
the library.

Details are in the blog post, including tips on how to do that - based
on our practical experience with Google Closure Compiler from another
projects. I can write also examples to demonstrate the described

The question for community is mostly:

- Are we willing to follow the JavaScript Style Guide, which is
necessary for the advanced compilation: http://bit.ly/9lETMA
- Do we want to write the correct JSDoc tags according to: http://bit.ly/3UNSlI

These are the decisions for OpenLayers 3.0, which should be done
before the one week active coding session is going to happen. BTW I am
keen to participate if it's going to be in Europe.


Klokan Petr Pridal

2010/12/2 Peter Robins <openlayers at peterrobins.co.uk>:
> I set up a ticket on this subject a couple of weeks ago, as it didn't
> seem to me to be limited to any particular version of OL and there's
> no reason why people can't start using it for their builds
> straightaway (though not mentioned in the ticket, I am also using GCC
> for my proj4js builds, with similar results)
> http://trac.osgeo.org/openlayers/ticket/2900
> Some further comments at http://trac.osgeo.org/openlayers/ticket/2925
> 2010/12/2 Klokan Petr Přidal <klokan at klokan.cz>:
>> Dear OpenLayers developers,
>> I wrote a blog post which is summarizing what can the open-sourced
>> Google Closure Compiler do for OpenLayers 3.0, how it can be done and
>> what are the implications.
>> Let's discuss this subject with the community. I am keen to get a
>> feedback and know what people think about that.
>> Please read the blog post:
>> http://blog.klokantech.com/2010/12/closure-compiler-for-openlayers-3x.html
>> And send comments...
>> Regards,
>> Klokan Petr Pridal
>> P.S.
>> I promised Tim Schaub at FOSS4G in Barcelona to publish such a post,
>> but it took me a bit longer then I expected...
>> --
>> http://blog.klokantech.com/
>> http://www.mapranksearch.com/
>> http://www.maptiler.org/
>> http://www.oldmapsonline.org/
>> _______________________________________________
>> Dev mailing list
>> Dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/openlayers-dev
> _______________________________________________
> Dev mailing list
> Dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-dev


More information about the Dev mailing list