When using OpenLayers.js slim version locally found here https://github.com/developmentseed/openlayers_slim/blob/master/OpenLayer...

My map loads correctly in preset edition, but not with views, according to firebug the openlayers.js is correctly loaded.

When using OpenLayers.js regular 2.11 version I have no problem.

I woud like to use the slimmed one, to reduce my page loading and use headjs module to parallel my javascript.
When using headjs with OpenLayers 2.11, the map is not loading. According this issue, it seems related to the weight of OpenLayers.js, things i could easily understand around 900K !

Any idea ?

Comments

heyyo’s picture

After other testing, it seems that OSM is working correctly with slim version but Google Map.

nod_’s picture

Category: bug » support

not a bug. check out OL docs at build profiles.

heyyo’s picture

I successfully created a lighter custom build. But it still doesn't load my map if headjs is enabled.
my Openlayers.js is now around 375KB unzipped, really better than more 900KB...But not sure if the weight is the cause of this bug.
Anyone succeeded to use OpenLayers and headjs at the same time ?

nod_’s picture

I believe it's a core thing. Drupal's JS is pretty terrible.

Drupal.js execute behaviors on dom ready, openlayers.js declare a behavior that needs OL.js to be loaded to run. But i believe you load OL.js with headjs and it's not loaded before dom ready. So you load everything (including drupal.js) with headjs and hope it runs or you're pretty much screwed and you can't use headjs to load OL.js.

heyyo’s picture

Thanks for you fast answer, but it seems that it won't help me so much :-(
My website:
http://guides-israel.com/fr/visiter/sud

If you have any idea to make it load faster...

ken-g’s picture

Issue summary: View changes
Status: Active » Closed (outdated)