We have lots of code from older versions of the module that I never really questioned that much. However, when I was making a new module recently, I did a full reading of the Libraries API "for developrs" docs. I realized we are rolling our own code for tons of stuff that Libraries provides, and simply making a hard dependency will allow me to remove a huge chunk of custom code we maintain.

Advantages:

  • Reduce number of code paths required to find and load Modernizr onto the page.
  • Turn it into a real, intelligent dependency, allowing it to be disabled if someone finds it desirable to do so.
  • They have version detection built in. We can use our regex, but it populates the library info array automatically.
  • Finally, Libraries API supports versions. I still feel like supporting Modernizr v3 in the 7.x-3.x branch will be hard due to the deprecation of yepnope. But version management for the future sounds like a good thing to me.

Disadvantages

  • Adding hard dependency without bumping major version might be confusing to many users. Also it could cause fatal things to happen unless thorough testing occurs.

I will give this a test and get a patch for review. I think we can use the $phase == 'update' part of hook_requirements() in order to avoid letting users upgrade without enabling the Libraries API first.

Comments

klonos’s picture

Taking a look at the usage stats of core and those of Libraries API, one can see that about 60% of Drupal 7 sites use Libraries API. So, chances are that our ~1% of D7 sites already has Libraries API installed.

Point is that I would not worry too much about adding it as a hard dependency. Though checking before allowing upgrade sounds like a good thing for just in case.

rupl’s picture

Nice! Thanks for the feedback and especially the bit of data. That's convincing enough for me.