Add back theme.js (#439)

* fix theme.js
* add preconnect support
This commit is contained in:
Ljcbaby 2022-01-24 13:14:14 +08:00 committed by GitHub
parent f860dcebc2
commit 8b4b4004c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -883,5 +883,7 @@ vendors:
# Assets
# Accelerate delivery of static files using a CDN
# The js option is only valid when vendors.internal is local.
css: css
js: js
images: images

View File

@ -25,7 +25,7 @@ hexo.extend.helper.register('next_js', function(file, pjax = false) {
version : next_version,
file : 'source/js/' + file,
minified: 'source/js/' + file.replace(/\.js$/, '.min.js'),
local : this.url_for(`js/${file}`),
local : this.url_for(`${this.theme.js}/${file}`),
custom : custom_cdn_url
});
const src = links[internal] || links.local;
@ -55,7 +55,7 @@ hexo.extend.helper.register('next_pre', function() {
const { enable, host } = this.theme.font;
const { internal, plugins, custom_cdn_url } = this.theme.vendors;
const links = {
local : '',
local : parse(this.theme.js || '').hostname,
jsdelivr: 'https://cdn.jsdelivr.net',
unpkg : 'https://unpkg.com',
cdnjs : 'https://cdnjs.cloudflare.com',