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

cdnjs的选项中,是否可以引入国内的一些厂商? #380

Open
3 tasks done
a2501521908 opened this issue Dec 4, 2024 · 2 comments
Open
3 tasks done

cdnjs的选项中,是否可以引入国内的一些厂商? #380

a2501521908 opened this issue Dec 4, 2024 · 2 comments
Labels
enhancement New feature or request feature request

Comments

@a2501521908
Copy link

Issue Checklist | Issue 检查清单

Feature Request | 功能需求

我在 https://github.com/XPoet/hexo-theme-keep/blob/master/scripts/helpers/helper.js 源码中看到,cdnjs枚举目前仅支持cloudflare。是否可以引入bootCDN、360CDN等国内速度较快的厂商?

case providerEnum.cdnjs:
  urlPrefix = 'https://cdnjs.cloudflare.com/ajax/libs/hexo-theme-keep'
  if (tyle === 'js') {
    path = path.includes('.min.js') ? path : path.replace('.js', '.min.js')
    return `<script src="${urlPrefix}/${version}/${path}"></script>`
  } else {
    path = path.includes('.min.css') ? path : path.replace('.css', '.min.css')
    return `<link rel="stylesheet" href="${urlPrefix}/${version}/${path}">`
  }

也就是说urlPrefix支持自定义,比如这样?

urlPrefix = 'https://cdn.bootcdn.net/ajax/libs/hexo-theme-keep'

具体的配置key是否可以在cdn.provider.cdnjs.custom下?

Other Information | 其它信息

No response

@XPoet
Copy link
Owner

XPoet commented Dec 4, 2024

挺好的建议,后续会支持自定义cdn 厂商

@XPoet XPoet added the enhancement New feature or request label Dec 4, 2024
@a2501521908
Copy link
Author

感觉这个功能cdn.provider.cdnjs.custom 配置项更可靠,因为它不会影响上层配置。如果用 cdn.provider.custom,就可能引入不确定性。比如,如果上层指定的是 jsdelivr,而 custom 用的是 cdnjs,就可能导致无法访问的问题~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature request
Projects
None yet
Development

No branches or pull requests

2 participants