xaoxuu / hexo-theme-stellar

内置文档系统的简约商务风Hexo主题,支持大量的标签组件和动态数据组件。
https://xaoxuu.com/wiki/stellar/
MIT License
1.19k stars 303 forks source link

[fix] fix typo - missing `;` for `"` #469

Closed calfzhou closed 1 month ago

calfzhou commented 1 month ago

article_footer 里 wechat 分享按钮的地方," 少写了一个分号。此 PR 修复该问题。

这个问题会导致通过 terser 对 html 内的 js 压缩的时候语法解析失败。

复现方式:

_config.stellar.ymlarticle.share 配置中确保添加了 wechat,开启 wechat 分享按钮。

以基于 @uiolee/hexo-htmlnano 插件为例,对构建物进行压缩:

pnpm add @uiolee/hexo-htmlnano cssnano postcss terser svgo
hexo generate

进行压缩的时候,terser 会报错:

SyntaxError: Unterminated string constant
    at js_error (/node_modules/.pnpm/terser@5.31.0/node_modules/terser/dist/bundle.min.js:536:11)
    at parse_error (/node_modules/.pnpm/terser@5.31.0/node_modules/terser/dist/bundle.min.js:672:9)
    at /node_modules/.pnpm/terser@5.31.0/node_modules/terser/dist/bundle.min.js:1043:36
    at Object.next_token [as input] (/node_modules/.pnpm/terser@5.31.0/node_modules/terser/dist/bundle.min.js:1076:40)
    ......

并导致所有开启了 wechat 分享按钮的页面压缩后的 html 代码均为空。

stackblitz[bot] commented 1 month ago

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

xaoxuu commented 1 month ago

感谢大佬🙏