cujojs / curl

curl.js is small, fast, extensible module loader that handles AMD, CommonJS Modules/1.1, CSS, HTML/text, and legacy scripts.
https://github.com/cujojs/curl/wiki
Other
1.89k stars 216 forks source link

css! plugin no longer returns anything in 0.7 #142

Closed asilvas closed 11 years ago

asilvas commented 11 years ago

Not certain if a big deal or not, but the css plugin no longer returns the content of the css in the return function.


require("css!my.css", function(css) {

css === undefined; // prior to 0.7, css was returned

});

Not a major issue for us, but wanted to make aware unless this was not intentional, as it seems inconsistent with other plugins.

unscriptable commented 11 years ago

In IE6-9, the stylesheet that was returned wasn't necessarily the same one as returned by other browsers since it may have been combined with other stylesheets to avoid the 31-sheet limit. Just wondering if it would be better to return something besides undefined?

asilvas commented 11 years ago

I see, that makes sense. We don't want people using bad or inconsistent data. Perhaps null? Or true? I don't like any of the options, really, but I do think it's at least important to differentiate from undefined.

If curl is ever changed to support returning of already-loaded data (i.e. var css = curl("css!my.css")), always returning undefined would be conflicting as I'd have no way to know if it's loaded or not.

unscriptable commented 11 years ago

Hey @asilvas, never mind my comment. I was thinking of the old css! plugin. We may be able to implement this with the new one. Actually, it looks doable. I moved this to be fixed in 0.7.2.

unscriptable commented 11 years ago

This is working in the dev branch.