perf: modified JS and CSS reference paths

This commit is contained in:
XPoet 2021-01-22 18:36:05 +08:00
parent 2c27ba7bcf
commit dc5e936b13
2 changed files with 4 additions and 8 deletions

View File

@ -27,8 +27,8 @@
<% } %>
<%= theme.base_info.title || config.title || 'Keep Theme' %>
</title>
<link rel="stylesheet" href="/css/style.css">
<%- favicon_tag(theme.style.favicon) %>
<%- css('css/style') %>
<%- __css('css/font-awesome.min.css') %>
<%- export_config() %>
</head>

View File

@ -44,12 +44,9 @@ hexo.extend.helper.register('getPostUrl', function (rootUrl, path) {
hexo.extend.helper.register('__js', function (path) {
const cdnPathHandle = (path_2) => {
const _js = hexo.extend.helper.get('js').bind(hexo);
return this.theme.cdn.enable
? `<script src="//cdn.jsdelivr.net/npm/hexo-theme-keep@${this.theme.version}/source/${path_2}"></script>`
: _js(path_2)
? `<script src="//cdn.jsdelivr.net/npm/hexo-theme-keep@${this.theme.version}/source/${path_2}"></script>`
: `<script src="/${path_2}"></script>`;
}
let t = ``;
@ -66,10 +63,9 @@ hexo.extend.helper.register('__js', function (path) {
});
hexo.extend.helper.register('__css', function (path) {
const _css = hexo.extend.helper.get('css').bind(hexo);
if (this.theme.cdn.enable) {
return `<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/hexo-theme-keep@${this.theme.version}/source/${path}">`;
} else {
return _css(path);
return `<link rel="stylesheet" href="/${path}">`
}
});