theme-next / hexo-theme-next

Elegant and powerful theme for Hexo.
https://theme-next.org
Other
8.17k stars 2.05k forks source link

use .min.js instead of .js for jsdelivr #1618

Closed njzjz closed 3 years ago

njzjz commented 3 years ago

Please follow this Issue template to provide relevant information, such as source code repositories, blog links, and screenshots, which will help us investigate. 请按照此 Issue 模版提供相关信息,例如源码仓库、博客链接和屏幕截图,这将有助于我们进行调查。

Issue Checklist


Expected behavior

I am wondering if we can use https://cdn.jsdelivr.net/npm/hexo-theme-next@8.2.1/source/js/utils.min.js (ends with .min.js) instead of https://cdn.jsdelivr.net/npm/hexo-theme-next@8.2.1/source/js/utils.js (ends with .js). The minified package is smaller than the original one.

Something like:

if (url.endsWith('.js') && ! url.endsWith(".min.js")) {
  url = url.slice(0,-3) + ".min.js";
}

Actual behavior

Currently, all scripts from jsdelivr are not minified.

Steps to reproduce the behavior

  1. N/A
  2. N/A
  3. N/A

Other Information

njzjz commented 3 years ago

提错仓库了……