🛠️ hexo scripts
This commit is contained in:
38
scripts/events/lib/hello.js
Normal file
38
scripts/events/lib/hello.js
Normal file
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = (hexo) => {
|
||||
const isZh = hexo.theme.i18n.languages[0].search(/zh-CN/i) !== -1;
|
||||
if (isZh) {
|
||||
hexo.log.info(`
|
||||
------------------------------------------------
|
||||
| |
|
||||
| __ ________ _____ |
|
||||
| /\\\\ \\ / / ____| __ \\ |
|
||||
| / \\\\ \\_/ /| |__ | |__) | |
|
||||
| / /\\ \\\\ / | __| | _ / |
|
||||
| / ____ \\| | | |____| | \\ \\ |
|
||||
| /_/ \\_\\_| |______|_| \\_\\ |
|
||||
| |
|
||||
| 感谢使用 Ayer 主题 ! |
|
||||
| 文档: https://shen-yu.gitee.io/2019/ayer/ |
|
||||
| |
|
||||
------------------------------------------------
|
||||
`);
|
||||
} else {
|
||||
hexo.log.info(`
|
||||
----------------------------------------------------
|
||||
| |
|
||||
| __ ________ _____ |
|
||||
| /\\\\ \\ / / ____| __ \\ |
|
||||
| / \\\\ \\_/ /| |__ | |__) | |
|
||||
| / /\\ \\\\ / | __| | _ / |
|
||||
| / ____ \\| | | |____| | \\ \\ |
|
||||
| /_/ \\_\\_| |______|_| \\_\\ |
|
||||
| |
|
||||
| Thank you for using Ayer theme ! |
|
||||
| Docs: https://github.com/Shen-Yu/hexo-theme-ayer |
|
||||
| |
|
||||
----------------------------------------------------
|
||||
`);
|
||||
}
|
||||
};
|
28
scripts/events/lib/merge-configs.js
Normal file
28
scripts/events/lib/merge-configs.js
Normal file
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
|
||||
const objUtil = require("../../utils/object");
|
||||
const { isNotEmptyObject } = require("../../utils/object");
|
||||
|
||||
module.exports = (hexo) => {
|
||||
const isZh = hexo.theme.i18n.languages[0].search(/zh-CN/i) !== -1;
|
||||
|
||||
if (isNotEmptyObject(hexo.config.theme_config)) {
|
||||
hexo.theme.config = objUtil.merge(
|
||||
{},
|
||||
hexo.theme.config,
|
||||
hexo.config.theme_config
|
||||
);
|
||||
if (isZh) {
|
||||
hexo.log.info("[Ayer] 读取 _config.yml 中 theme_config 配置项覆盖配置");
|
||||
} else {
|
||||
hexo.log.info(
|
||||
"[Ayer] Merge theme config from theme_config in _config.yml"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
hexo.log.debug(
|
||||
"[Ayer] Output theme config:\n",
|
||||
JSON.stringify(hexo.theme.config, undefined, 2)
|
||||
);
|
||||
};
|
Reference in New Issue
Block a user