开发者

Resource Loader with ready() function call and that also loads CSS?

Ideally I'm looking for a Javascript resource loader that will:

(1) Allow me to make 开发者_C百科"ready" calls like head.js does, e.g.

head.ready(function() {
   $("#my").jquery_plugin();
});

// load jQuery whenever you wish bottom of the page
head.js("/path/to/jquery.js");

(2) Load CSS files like yepnope (which can also handle file names with hash on the end by using the css! prefix). I don't particularly need the conditional load functionality (at this stage).

(3) Ideally, only load resources once even if multiple calls are made (head.js does this automatically, yepnope does this with a filter).

At the moment I'm resorting to using both head.js and yepnope, as I haven't been able to find one that supports both the first two requirements. Obviously this is not ideal, as both together (with filters and prefixes) come to 7kb minified. I think this is a bit too heavy as a bootstrap script.

One option is roll my own using a combination of the two and strip out the functionality I don't need... but I'd rather stick to one that's going to be supported to reduce the pain of future updates etc.


So we stuck with a combination head.js and yepnope until something better comes out.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜