Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add plugin hexo-htmlnano-mini #2285

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

RoversX
Copy link

@RoversX RoversX commented Nov 7, 2024

Check List

Please read and check followings before submitting a PR.

  • I want to publish my theme on Hexo official website.
    • I have read the theme publishing doc.
    • name is unique.
    • link URL is correct.
    • preview URL is correct.
    • preview URL web site is rendered correctly.
    • Add a screenshot to source/themes/screenshots.
    • Screenshot filename is same as value of name.
    • Screenshot size is 800 * 500.
    • Screenshot file format is png.
  • I want to publish my plugin on Hexo official website.
  • Others (Update, fix, translation, etc...)
    • Languages:
    • en English

@github-actions github-actions bot added the Plugins _data/pluguns/ label Nov 7, 2024
Copy link
Contributor

github-actions bot commented Nov 7, 2024

Theme thumbnails validation completed.

Comment on lines +7 to +8
- css
- js
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does hexo-htmlnano-mini will also work on css/js files?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I initially tested this on my blog and resolved several issues during the process.

It now supports HTML minification using htmlnano, CSS minification with clean-css, and JavaScript minification with uglify-js. Additionally, it’s compatible with the hexo-blog-encrypt plugin. The default packages, cssnano and Terser, had some issues, so I replaced them with clean-css and uglify-js from html-minifier.
https://github.com/RoversX/hexo-htmlnano-mini/blob/main/package.json

htmlnano-mini:
  enable: true                        # 主开关
  enableInDev: false                  # 是否在开发服务器(hexo s)中启用压缩
  exclude: 
     #- '**/mycss.css'       
  collapseWhitespace: conservative    # 保守地压缩空白字符
  removeComments: safe                # 安全地移除注释
  removeEmptyAttributes: true         # 移除空属性 
  cleancss: true                      # 启用 clean-css 处理 CSS
  uglifyjs: true                      # 启用JavaScript 的压缩

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Plugins _data/pluguns/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants