Add new CDN vendor who name is qiniu & bootcdn.

This commit is contained in:
凡梦星尘 2022-10-30 16:54:38 +08:00
parent e1c088c355
commit 7c9b834729
4 changed files with 19 additions and 9 deletions

View File

@ -221,8 +221,13 @@ NexT.utils = {
let res_src = '';
switch (plugins) {
case 'cdnjs':
case 'bootcdn':
case 'qiniu':
let cdnjs_name = alias || name;
let cdnjs_file = file.replace(/\.js$/, '.min.js').replace(/^(dist|lib|source\/js|)\/(browser\/|)/, '');
let cdnjs_file = file.replace(/^(dist|lib|source|\/js|)\/(browser\/|)/, '');
if (cdnjs_file.indexOf('min') == -1) {
cdnjs_file = cdnjs_file.replace(/\.js$/, '.min.js');
}
res_src = `${router}/${cdnjs_name}/${version}/${cdnjs_file}`
break;
default:

View File

@ -3,6 +3,8 @@
vendors:
cdnjs: "https://cdnjs.cloudflare.com/ajax/libs"
unpkg: "https://unpkg.com"
bootcdn: "https://cdn.bootcdn.net/ajax/libs"
qiniu: "https://cdn.staticfile.org"
# JavaScript 资源
# JavaScript Resources
@ -82,11 +84,11 @@ livere:
# Full text search
algolia:
name: algoliasearch
version: 4.13.0
version: 4.14.2
file: dist/algoliasearch-lite.umd.js
instant:
name: instantsearch.js
version: 4.40.5
version: 4.49.0
file: dist/instantsearch.production.min.js
plugins:

View File

@ -103,6 +103,7 @@ enableRobotsTXT: true
# 强制输出时压缩文件
# Compress all files when output
minify:
minifyOutput: true
#--------------------------------------
# 菜单配置说明
@ -302,7 +303,7 @@ params:
enable: true
# 组件类型,可选值为: 51la, busuanzi
# 使用51la时需要注册账号https://invite.51.la/1NUfGTS1?target=V6
# Plguin value is: 51la, busuzazi
# Plguin value is: 51la, busuanzi
plugin: busuanzi
# 社交链接地址
@ -809,7 +810,8 @@ params:
# Waline comments system
# More info seee: https://waline.js.org/
waline:
pageView: '#waline-pageview-count'
pageView: true
comment: true
placeholder: "请文明发言哟 ヾ(≧▽≦*)o"
sofa: "快来发表你的意见吧 (≧∀≦)ゞ"
emoji: false
@ -1091,14 +1093,15 @@ params:
# ---------------------------------------------------------------
vendors:
vendors:
# The CDN provider of NexT internal scripts.
# Available values: local | unpkg | cdnjs | custom
# Available values: local | unpkg | cdnjs | qiniu | bootcdn | custom
# Warning: If you are using the latest master branch of NexT, please set `internal: local`
internal: local
# The default CDN provider of third-party plugins.
# Available values: local | unpkg | cdnjs | custom
# Available values: local | unpkg | cdnjs| qiniu | bootcdn | custom
# Dependencies for `plugins: local`: https://github.com/next-theme/plugins
plugins: unpkg
plugins: qiniu
# TODO
# Custom CDN URL
# For example:

View File

@ -8,7 +8,7 @@
{{ end }}
{{- $file := .res.file }}
{{- if eq .vendor "cdnjs" }}
{{- if ne .vendor "unpkg" }}
{{- with .res.alias }}
{{- $npm = . }}
{{- end }}