Skip to content

A lightweight Hexo plugin to minify HTML using htmlnano

Notifications You must be signed in to change notification settings

RoversX/hexo-htmlnano-mini

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hexo-htmlnano-mini

npm npm NPM Last Update

A lightweight Hexo plugin to minify HTML/css/js using htmlnano. This plugin helps reduce HTML file sizes, improving loading speed and optimizing site performance.

This plugin was made to replace https://github.com/hexojs/hexo-html-minifier

Npm Link: https://www.npmjs.com/package/hexo-htmlnano-mini

Installation

To install hexo-htmlnano-mini, use the following command in your Hexo project:

npm install hexo-htmlnano-mini --save

Configuration

After installation, add the following htmlnano configuration to your Hexo project’s _config.yml file. Adjust the settings as needed for your project.

htmlnano-mini:
  enable: true                        # Main switch
  enableInDev: false                   # Whether to enable compression in the development server (hexo s)
  exclude: 
     #- '**/mycss.css'       
  collapseWhitespace: conservative    # Conservatively collapse whitespace characters
  removeComments: safe                # Safely remove comments
  removeEmptyAttributes: true         # Remove empty attributes
  cleancss: true                      # Enable clean-css to process inline CSS
  uglifyjs: true                      # Enable compression of inline JavaScript

Usage

Once installed and configured, the plugin will automatically compress HTML files (including inline CSS, JS, and SVG) during the generation process. To apply the plugin, simply run:

hexo g

The plugin will log size reductions for each file, helping you track the compression progress.

License

MIT License

About

A lightweight Hexo plugin to minify HTML using htmlnano

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published