jquery-ujs icon indicating copy to clipboard operation
jquery-ujs copied to clipboard

Add support to be loaded as an AMD module

Open billmag opened this issue 13 years ago • 2 comments
trafficstars

It'd be great if jquery-ujs defined itself so it could be loaded by RequireJS (http://requirejs.org/) with jQuery as a dependency.

Newer versions of jQuery now support this, so one would be able to list jquery_ujs as a dependency instead of jquery in their modules and require.js would do the right thing.

billmag avatar Jun 28 '12 18:06 billmag

For now, I'm going to mark this as a potential future enhancement. I'm not opposed to adding AMD support, but I'm cautiously skeptical. The issues with adding AMD support are described in-depth in this thread for underscore.js and [this discussion in sylvester.js[(https://github.com/jcoglan/sylvester/issues/8#issuecomment-7207071).

The short version is, adding AMD support could potentially break applications which happen to be using RequireJS but not for jquery-ujs. This can be avoided by defining some boilerplate to load both the AMD definition and the global namespace, but it's a lot of boilerplate considering you can already use jquery-ujs with RequireJS using the shim config.

JangoSteve avatar Aug 13 '12 20:08 JangoSteve

@JangoSteve +1 for this. Fun running into you on this thread. Hope you're well.

leppert avatar Dec 04 '14 19:12 leppert