Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Future]支持快速切换CDN加载js库 #783

Closed
myoss opened this issue Apr 2, 2016 · 11 comments
Closed

[Future]支持快速切换CDN加载js库 #783

myoss opened this issue Apr 2, 2016 · 11 comments

Comments

@myoss
Copy link

myoss commented Apr 2, 2016

Expected behavior (预期行为)

支持CDN加速js库,这是我自己改动后的效果
qq 20160402091445
qq 20160402092654

Actual behavior (实际行为)

现在source\vendors目录下js库存放的路径不能快速的切换到CDN

Steps to reproduce the behavior (重现步骤)

NexT Informations

Add the ✔ sign before an item which is affected by this behavior.

NexT Version:

  • Master ✔
  • Latest Release
  • Old version -

NexT Scheme:

  • All schemes
  • Muse
  • Mist
  • Pisces ✔

Other Informations (Like Browser, System, Screenshots)

  • chrome 49
  • windows 10
@iissnan
Copy link
Owner

iissnan commented Apr 3, 2016

想法不错。

不过要进行切换的前提是 cdn 之间包的存储是否采用相同的路径,我感觉这个不能受保证。

@myoss
Copy link
Author

myoss commented Apr 4, 2016

现在大部分的CDN厂商提供的加速服务,在路径上都是一致的,除了少部分(比如:新浪)提供的特殊,所以是可以考虑这么做的,既然都能支持大部分的厂商了,总比没有的好吧,希望你能考虑一下吧,对于整个项目来说实施起来也不是非常困难的事情。

这是我之前收集到的一些CDN厂商(地址:常用的-JavaScript-库-CDN-加速服务),或者Google

  1. https://developers.google.com/speed/libraries/#jquery
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
  1. http://libs.useso.com/

    http://libs.useso.com/js/jquery/2.0.3/jquery.js
    
  2. http://developer.baidu.com/wiki/index.php?title=docs/cplat/libs#jQuery

    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.js"></script>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    
  3. http://www.bootcdn.cn/jquery/

    //cdn.bootcss.com/jquery/2.2.1/jquery.js
    

@myoss
Copy link
Author

myoss commented Apr 4, 2016

#629 这个功能非常棒,这两天更新用上了非常不错,感谢作者~~~

@mritd
Copy link

mritd commented Apr 5, 2016

我想知道 我有自己的 cdn 怎么破??? upyun 七牛 都有

@panzhitian
Copy link
Contributor

为什么不把jquery.fancybox.css和font-awesome也加进去呢?

@iissnan
Copy link
Owner

iissnan commented Apr 9, 2016

jquery.fancybox.css 应该是要开放出去,避免版本不一致的问题。

FontAwesome 我还没想好怎么处理。

@mritd
Copy link

mritd commented Apr 12, 2016

今天测试了一下。。。因为这几个 JS。。。加载硬是拖到 40S。。。 能否提供个 自定义 这几个 js 路径的功能? 我所有图片全部放在 upyun上。。。如果可以我想自己把这几个 js 拿下来放到自己的 cdn 上。

@panzhitian
Copy link
Contributor

自己硬改是可以的。我猜作者应该在考虑fallback的处理。

@urzone
Copy link

urzone commented Apr 24, 2016

头疼的FontAwesome啊,直接加载了22s 出去了。。。。
screen shot 2016-04-25 at 00 28 19

@iissnan
Copy link
Owner

iissnan commented May 5, 2016

@panzhitian jquery.fancybox.css 和 font-awesome 都可以设置 CDN 地址。
@mritd 可以自定义资源的路径,例如:

vendors:
  # Internal path prefix. Please do not edit it.
  _internal: vendors

  # Internal version: 2.1.3
  jquery: //cdn.jsdelivr.net/jquery/2.1.3/jquery.min.js

  # Internal version: 2.1.5
  # Fancybox: http://fancyapps.com/fancybox/
  fancybox: //cdn.jsdelivr.net/fancybox/2.1.5/jquery.fancybox.pack.js
  fancybox_css: //cdn.jsdelivr.net/fancybox/2.1.5/jquery.fancybox.min.css

  # Internal version: 1.0.6
  fastclick: //cdn.jsdelivr.net/fastclick/1.0.6/fastclick.min.js

  # Internal version: 1.9.7
  lazyload: //cdn.jsdelivr.net/jquery.lazyload/1.9.3/jquery.lazyload.min.js

  # Internal version: 1.2.1
  velocity: //cdn.jsdelivr.net/velocity/1.2.3/velocity.min.js

  # Internal version: 1.2.1
  velocity_ui: //cdn.jsdelivr.net/velocity/1.2.3/velocity.ui.min.js

  # Internal version: 0.7.9
  ua_parser: //cdn.jsdelivr.net/ua-parser.js/0.7.10/ua-parser.min.js

  # Internal version: 4.4.0
  # http://fontawesome.io/
  fontawesome: //maxcdn.bootstrapcdn.com/font-awesome/4.6.2/css/font-awesome.min.css

@iissnan
Copy link
Owner

iissnan commented May 12, 2016

@iissnan iissnan closed this as completed May 12, 2016
habren pushed a commit to habren/hexo-theme-next that referenced this issue Apr 8, 2017
habren pushed a commit to habren/hexo-theme-next that referenced this issue Apr 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants