Skip to content

Commit

Permalink
refactor: update CDN provider URLs and update zstatic option
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanNotFound committed Jun 2, 2024
1 parent 666c228 commit cb7ae04
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ cdn:
# Whether to enable CDN
enable: false
# CDN Provider
provider: aliyun # zstatic, sustech, staticfile, bootcdn, cdnjs, jsdelivr, unpkg, aliyun, custom
provider: zstatic # zstatic, sustech, staticfile, bootcdn, cdnjs, jsdelivr, unpkg, aliyun, custom
# Custom CDN URL
# format example: https://cdn.custom.com/hexo-theme-redefine/${version}/source/${path}
# The ${path} must leads to the root of the "source" folder of the theme
Expand Down
20 changes: 8 additions & 12 deletions scripts/helpers/themeHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ hexo.extend.helper.register("renderJS", function (path) {
staticfile: "https://cdn.staticfile.net",
bootcdn: "https://cdn.bootcdn.net/ajax/libs",
sustech: "https://mirrors.sustech.edu.cn/cdnjs/ajax/libs",
zstatic: "https://s4.zstatic.net/ajax/libs",
zstatic: "https://s4.zstatic.net/npm",
cdnjs: "https://cdnjs.cloudflare.com/ajax/libs",
unpkg: "https://unpkg.com",
jsdelivr: "https://cdn.jsdelivr.net/npm",
Expand Down Expand Up @@ -123,8 +123,7 @@ hexo.extend.helper.register("renderJS", function (path) {
this.theme.cdn.provider === "staticfile" ||
this.theme.cdn.provider === "bootcdn" ||
this.theme.cdn.provider === "cdnjs" ||
this.theme.cdn.provider === "sustech" ||
this.theme.cdn.provider === "zstatic"
this.theme.cdn.provider === "sustech"
) {
return this.theme.cdn.enable
? `<script src="${cdnBase}/hexo-theme-redefine/${themeVersion}/${path}"></script>`
Expand Down Expand Up @@ -155,7 +154,7 @@ hexo.extend.helper.register("renderJSModule", function (path) {
staticfile: "https://cdn.staticfile.net",
bootcdn: "https://cdn.bootcdn.net/ajax/libs",
sustech: "https://mirrors.sustech.edu.cn/cdnjs/ajax/libs",
zstatic: "https://s4.zstatic.net/ajax/libs",
zstatic: "https://s4.zstatic.net/npm",
cdnjs: "https://cdnjs.cloudflare.com/ajax/libs",
unpkg: "https://unpkg.com",
jsdelivr: "https://cdn.jsdelivr.net/npm",
Expand Down Expand Up @@ -184,8 +183,7 @@ hexo.extend.helper.register("renderJSModule", function (path) {
this.theme.cdn.provider === "staticfile" ||
this.theme.cdn.provider === "bootcdn" ||
this.theme.cdn.provider === "cdnjs" ||
this.theme.cdn.provider === "sustech" ||
this.theme.cdn.provider === "zstatic"
this.theme.cdn.provider === "sustech"
) {
return this.theme.cdn.enable
? `<script type="module" src="${cdnBase}/hexo-theme-redefine/${themeVersion}/${path}"></script>`
Expand Down Expand Up @@ -216,7 +214,7 @@ hexo.extend.helper.register("renderJSPath", function (path) {
staticfile: "https://cdn.staticfile.net",
bootcdn: "https://cdn.bootcdn.net/ajax/libs",
sustech: "https://mirrors.sustech.edu.cn/cdnjs/ajax/libs",
zstatic: "https:https://s4.zstatic.net/ajax/libs",
zstatic: "https://s4.zstatic.net/npm",
cdnjs: "https://cdnjs.cloudflare.com/ajax/libs",
unpkg: "https://unpkg.com",
jsdelivr: "https://cdn.jsdelivr.net/npm",
Expand All @@ -243,8 +241,7 @@ hexo.extend.helper.register("renderJSPath", function (path) {
this.theme.cdn.provider === "staticfile" ||
this.theme.cdn.provider === "bootcdn" ||
this.theme.cdn.provider === "cdnjs" ||
this.theme.cdn.provider === "sustech" ||
this.theme.cdn.provider === "zstatic"
this.theme.cdn.provider === "sustech"
) {
return this.theme.cdn.enable
? `${cdnBase}/hexo-theme-redefine/${themeVersion}/${path}`
Expand Down Expand Up @@ -275,7 +272,7 @@ hexo.extend.helper.register("renderCSS", function (path) {
staticfile: "https://cdn.staticfile.net",
bootcdn: "https://cdn.bootcdn.net/ajax/libs",
sustech: "https://mirrors.sustech.edu.cn/cdnjs/ajax/libs",
zstatic: "https://s4.zstatic.net/ajax/libs",
zstatic: "https://s4.zstatic.net/npm",
cdnjs: "https://cdnjs.cloudflare.com/ajax/libs",
unpkg: "https://unpkg.com",
jsdelivr: "https://cdn.jsdelivr.net/npm",
Expand Down Expand Up @@ -304,8 +301,7 @@ hexo.extend.helper.register("renderCSS", function (path) {
this.theme.cdn.provider === "staticfile" ||
this.theme.cdn.provider === "bootcdn" ||
this.theme.cdn.provider === "cdnjs" ||
this.theme.cdn.provider === "sustech" ||
this.theme.cdn.provider === "zstatic"
this.theme.cdn.provider === "sustech"
) {
return this.theme.cdn.enable
? `<link rel="stylesheet" href="${cdnBase}/hexo-theme-redefine/${themeVersion}/${path}">`
Expand Down

0 comments on commit cb7ae04

Please sign in to comment.