descriptionYet Another Minifier. Minify and compress html, js, css and svg.
homepage URLhttps://github.com/curbengh/hexo-yam
repository URLhttps://github.com/curbengh/hexo-yam.git
ownercurben@users.noreply.repo.or.cz
last changeSun, 28 Jan 2024 10:44:53 +0000 (28 21:14 +1030)
last refreshSat, 27 Apr 2024 09:17:33 +0000 (27 11:17 +0200)
content tags
add:
README.md

hexo-yam

npm version Build Status codecov NPM Dependencies Known Vulnerabilities

Yet Another Minifier for Hexo. Minify and compress HTML, JS, CSS, SVG, XML and JSON. Other files are also compressed. Support gzip and brotli compressions.

Table of contents

Installation

$ npm install hexo-yam --save

Options

minify:
  enable: true
  html:
  css:
  js:
  svg:
  gzip:
  brotli:
  xml:
  json:

HTML

minify:
  html:
    enable: true
    exclude:

For more options, see HTMLMinifier.

CSS

minify:
  css:
    enable: true
    exclude:
      - '*.min.css'

For more options, see clean-css.

JS

minify:
  js:
    enable: true
    exclude:
      - '*.min.js'

For more options, see Terser.

SVG

minify:
  svg:
    enable: true
    include:
      - '*.svg'
      - '!*.min.svg'
plugins:
  # Retain comments
  removeComments: false
  # Do not remove unused ID attributes
  cleanupIds: false

Gzip

minify:
  gzip:
    enable: true
    include:
      - '*.html'
      - '*.css'
      - '*.js'
      - '*.txt'
      - '*.ttf'
      - '*.atom'
      - '*.stl'
      - '*.xml'
      - '*.svg'
      - '*.eot'
      - '*.json'

Brotli

minify:
  brotli:
    enable: true
    include:
      - '*.html'
      - '*.css'
      - '*.js'
      - '*.txt'
      - '*.ttf'
      - '*.atom'
      - '*.stl'
      - '*.xml'
      - '*.svg'
      - '*.eot'
      - '*.json'

XML

Remove whitespaces in xml.

minify:
  xml:
    enable: false
    include:
      - '*.xml'
      - '!*.min.xml'

For more options, see minify-xml.

JSON

Remove whitespaces in json.

minify:
  json:
    enable: false
    include:
      - '*.json'
      - '!*.min.json'

Globbing

Use "globOptions" to customise how glob patterns match files. Refer to micromatch for available options.

exclude:
  - '*foo.html' # basename is enabled
  - '**/bar/*/*.html' # basename is automatically disabled
  - '*baz.css' # basename is enabled
globOptions:
  basename: true # default
include:
  - '!foo.svg'
  - '!**/bar/*/*.svg'
globOptions:
  basename: true

HTTP Compression

While most modern web browsers support Brotli, you also need to consider whether the web/app server, hosting platform, reverse proxy or CDN (whichever relevant to you) support it.

Brotli support as of May 2022:

NameBrotli support
GitHub PagesIn consideration
GitLab PagesYes
NetlifyYes
Hexo ServerIn progress

If you have access to the web server config, you should disable on-the-fly compression for static files (that are already compressed by this plugin),

Credits

All credits go to the following work:

shortlog
2024-01-28 Ming Di LeomMerge pull request #150 from curbengh/dependabot/github... master
2024-01-28 Ming Di LeomMerge pull request #149 from curbengh/dependabot/github...
2024-01-28 Ming Di LeomMerge pull request #145 from curbengh/dependabot/github...
2024-01-28 Ming Di LeomMerge pull request #151 from curbengh/dependabot/npm_an...
2024-01-28 Ming Di LeomMerge pull request #152 from curbengh/html-minifier...
2024-01-28 MDLeomrefactor: switch html-minifier to html-minifier-terser
2024-01-19 dependabot... chore(deps-dev): bump hexo from 6.3.0 to 7.1.0
2024-01-18 dependabot... chore(deps): bump actions/cache from 3 to 4
2023-12-13 dependabot... chore(deps): bump github/codeql-action from 2 to 3
2023-12-12 MDLeomci: node 20
2023-12-12 MDLeomtest: node 21
2023-10-24 dependabot... chore(deps): bump actions/setup-node from 3 to 4
2023-10-01 Ming Di LeomMerge pull request #142 from curbengh/dependabot/github...
2023-10-01 dependabot... chore(deps): bump actions/checkout from 3 to 4
2023-10-01 MDLeomchore(node): drop Node 16
2023-10-01 Ming Di LeomMerge pull request #143 from curbengh/bun
...
tags
17 months ago v8.0.0
23 months ago v7.0.0
2 years ago v6.0.0
2 years ago v5.0.0
3 years ago v4.2.0
4 years ago v4.1.0
4 years ago v4.0.0
4 years ago v3.2.3
4 years ago v3.2.2
4 years ago v3.2.1
4 years ago v3.2.0
4 years ago v3.1.0
4 years ago v3.0.0
4 years ago v2.2.1
4 years ago v2.2.0
4 years ago v2.1.1
...
heads
2 months ago dependabot/github_actions/codecov/codecov-action-4
2 months ago master
17 months ago 8.0
17 months ago swc
5 years ago upstream