Alternatives to YepNope and LabJS

不羁岁月 提交于 2019-12-21 02:28:10

问题


I am wanting to load javascript and css files via a resource loader. I was originally using LabJs but I found YepNope more elegant and easier to work with in my scenario. However I am finding it devastatingly slow, which is odd as apparently it is comparable to LabJs in speed on most things.

One thing I do have are Etags which I am sure will slow everything down as its still requesting from the server rather than just working off the client cache.

Anyway there isnt much outside of the main YepNope site, and they havent released a new version with the fixes on their issues list in a while, so I was wondering what other options there are out there...

My requirements are:

  • Needs to load Css and Javascript
  • Needs to do them all in parallel
  • Can be loaded via Javascript

I wish YepNope was a bit more active but wanted to weigh up the other options...


回答1:


headjs has a lot of features and covers what you are asking for.




回答2:


I would throw require.js up for consideration. It will dynamically add script and css tags to the <head> so it works nicely asynchronously. It will also optimize all your js into one file so if you project is like mine you'll have dozens of js files in development (I think we have about 100) but only 1 for production.

The only thing I haven't got working yet is the optimization of the css files though apparently it has been done.

Good luck



来源:https://stackoverflow.com/questions/7960166/alternatives-to-yepnope-and-labjs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!