Hello,

We are using http://drupal.org/project/core_library to minify and aggregate JS files in a more advanced manner and we found that you have weight = -2 for your JS which fails because it is loaded too early (before Drupal core). Can you remove weight at all? Do you need it for anything?

Another issue is that you specify group = JS_LIBRARY and Drupal puts this file into another group together with core libraries which is not good since all custom files must be in another group that will be loaded later.

This is not a problem when you use standard Drupal aggregation but when Core Library compresses files it spoils the order.

Comments

Matthew Davidson’s picture

Status: Active » Postponed

You should have the same issue with Views contextual links, as we've just copied their technique, much better documented in their code. (It seemed somehow indecent, having copied their code, to copy their documentation as well.)

Basically Views wants to get in before core in order to attach the contextual links menu to a more specific region of the page than the body element, and we do too for the same reasons. I can't remember exactly why we need to get in before Views on those pages where Views pull this trick (making us weigh -2 rather than -1), but it doesn't really affect your issue; one way or another there's some JavaScript loaded before core libraries at weight 0.

I'm inclined to think that since it's possible to load JavaScript before core, and we're not the only contrib module doing so, Core Library is just going to have to learn to deal with it. At the time of writing they seem to have a lot of pretty fundamental issues outstanding, including breaking the admin overlay (!), so I also think there's a good chance that fixing those issues will fix this issue en passant.

I'm always willing to look at any ideas others can come up with, but I don't think it makes sense to try to work around this issue until there's a reasonably stable release of Core Library.

ardas’s picture

May be yes, but anyway I suggest only things that can help to avoid conflicts between these modules. I am not a fan of core_library module by several reasons but it is quite well known and one of two existing modules for D7 which provides alternative (more fast) way of compressing JSes.

I just thought that setting weight to -2 is not a problem if your JS has another type. So, my only concern is:
contextual admin JS should not have JS_LIBRARY since it is a higher level module. Could you change it to a type that is suggested to use for high level modules and keep weight = -2?

Will it break anything for you?