Did I ask too much?! All I wanted was to load a jQuery plugin from a bookmarklet. Before I could say “CoffeeScript”, found myself mired in the bog that is dynamic script loading.
- In our case, using a bookmarklet, so by definition patching an already loaded DOM.
- But even when we control the served HTML, lazy loading makes sense, to both improve performance by letting browser parallelize loading and rendering, to present something earlier, but also for progressive enhancement: selectively load functionality as needed.
- CommonJS (CJS), RequireJS, et al
- Bookmarklet: bootstrapping
- jQuery, but which version?
- Constants: “cached” JSON
- jQuery plugins: replace, qTip2…
- And our own code!
- To combine, or not to combine?