结合 LABjs 和 Modernizr 以及 yepnopejs
我一直在使用 LABjs 并且运行良好。
我现在正在尝试使用很棒的 Modernizr,并注意它使用 yepnopejs 用于条件资源加载。
由于我确实想要条件加载,我可以同时使用 LABjs 和 yepnopejs 吗?还是我必须专门选择一个?如果有人有一起使用这些的经验,我将不胜感激您的反馈。谢谢!
I've been using LABjs and it's working well.
I'm now trying to make use of the awesome Modernizr, and notice that it uses yepnopejs for conditional resource loading.
Since I do want conditional loading, can I use LABjs and yepnopejs together? Or must I pick one exclusively? If anyone has experience using these together, I'd appreciate your feedback. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
LABjs 可以进行条件加载,就像 yepnope 一样(它只是没有 yepnope 那样性感的 API)。
-或者-
因此,您应该能够使用 LABjs 进行加载,并使用 Modernizr 进行 HTML5 功能测试。
现在,令人遗憾的是,modernizr 还附带了 yepnope,这导致加载的代码比您需要的稍多,因为您有两个加载器。在这种情况下,您可以选择放弃 LABjs 并仅使用 yepnope,或者您可以忽略这个小问题(目前*)。
我强烈建议继续使用 LABjs,因为它的加载功能比 yepnope 更强大/面向未来(但没有那么广泛)。
*我计划发布“yeahno.js”,它将是底层的 LABjs,上面是 yepnope API,以便两全其美。然后,您可以将 Modernizr、yepnope (API) 和 LABjs 全部加载在一起,无需额外费用。请继续关注http://github.com/getify/yeahno.js。
LABjs can do conditional loading, just like yepnope can (it just doesn't have quite as sexy of an API for that as yepnope).
-or-
So, you should be able to do your loading with LABjs, and your HTML5 feature-testing stuff with modernizr.
Now, it IS a shame that modernizr also comes with yepnope and that this leads to slightly more code being loaded than you need, since you have two loaders. In that case, you could choose to ditch LABjs and only use yepnope, or you could just overlook that minor issue (for now*).
I strongly recommend staying with LABjs since its loading functionality under the covers is more robust/future-proof (but not as broad) than yepnope.
*I'm planning to release "yeahno.js" which will be LABjs underneath, with the yepnope API on top of it, to get the best of both worlds. Then, you can have modernizr, yepnope (API), and LABjs loading all in one, with no extra cost. Stay tuned to http://github.com/getify/yeahno.js.