{"id":25532471,"url":"https://github.com/curbengh/hexo-yam","last_synced_at":"2025-08-22T18:09:53.649Z","repository":{"id":35050455,"uuid":"150512521","full_name":"curbengh/hexo-yam","owner":"curbengh","description":"Yet Another Minifier. Minify static web assets and compress using brotli and zstd.","archived":false,"fork":false,"pushed_at":"2024-06-24T15:20:36.000Z","size":314,"stargazers_count":26,"open_issues_count":7,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-20T18:18:04.747Z","etag":null,"topics":["hexo","hexo-plugin","minify"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/curbengh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-27T01:44:39.000Z","updated_at":"2024-11-27T06:15:17.000Z","dependencies_parsed_at":"2023-01-15T12:46:49.939Z","dependency_job_id":"772019e6-2123-4e02-9396-649af6eab944","html_url":"https://github.com/curbengh/hexo-yam","commit_stats":{"total_commits":278,"total_committers":7,"mean_commits":"39.714285714285715","dds":"0.47482014388489213","last_synced_commit":"f65e7e7a2256ee482a61e8209e33c41a28b2ab84"},"previous_names":[],"tags_count":47,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curbengh%2Fhexo-yam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curbengh%2Fhexo-yam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curbengh%2Fhexo-yam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curbengh%2Fhexo-yam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/curbengh","download_url":"https://codeload.github.com/curbengh/hexo-yam/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248384648,"owners_count":21094750,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hexo","hexo-plugin","minify"],"created_at":"2025-02-20T01:49:25.093Z","updated_at":"2025-08-22T18:09:53.643Z","avatar_url":"https://github.com/curbengh.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hexo-yam\n\n[![npm version](https://img.shields.io/npm/v/hexo-yam?logo=npm)](https://www.npmjs.com/package/hexo-yam)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/curbengh/hexo-yam/tester.yml?branch=master\u0026logo=github)](https://github.com/curbengh/hexo-yam/actions?query=workflow%3ATester)\n[![codecov](https://img.shields.io/codecov/c/gh/curbengh/hexo-yam?logo=codecov)](https://codecov.io/gh/curbengh/hexo-yam)\n[![NPM Dependencies](https://img.shields.io/librariesio/release/npm/hexo-yam)](https://libraries.io/npm/hexo-yam)\n[![Known Vulnerabilities](https://snyk.io/test/github/curbengh/hexo-yam/badge.svg)](https://snyk.io/test/github/curbengh/hexo-yam)\n\nYet Another Minifier for Hexo. Minify HTML, JS, CSS, SVG, XML and JSON. Compress static [web assets](https://github.com/curbengh/hexo-yam/blob/ba77db0094a7c07ea9f70f010bfc15541d4105ca/index.js#L64) using gzip, brotli and zstd.\n\n## Table of contents\n\n- [Installation](#installation)\n- [Options](#options)\n- [HTML](#html)\n- [CSS](#css)\n- [JS](#js)\n- [SVG](#svg)\n- [XML](#xml)\n- [JSON](#json)\n- [Gzip](#gzip)\n- [Brotli](#brotli)\n- [Zstd](#zstd)\n- [Globbing](#globbing)\n\n## Installation\n\n```bash\n$ npm install --save hexo-yam\n```\n\n## Options\n\n```yaml\nminify:\n  enable: true\n  previewServer: true\n  html:\n  css:\n  js:\n  svg:\n  gzip:\n  brotli:\n  xml:\n  json:\n```\n\n- **enable** - Enable the plugin. Defaults to `true`.\n- **previewServer** - Disable the plugin when running `hexo server`. Defaults to `true`.\n- **html** - See [HTML](#html) section\n- **css** - See [CSS](#css) section\n- **js** - See [JS](#js) section\n- **svg** - See [SVG](#svg) section\n- **gzip** - See [Gzip](#gzip) section\n- **brotli** - See [Brotli](#brotli) section\n- **xml** - See [XML](#xml) section\n- **json** - See [JSON](#json) section\n\n## HTML\n\n```yaml\nminify:\n  html:\n    enable: true\n    exclude:\n```\n\n- **enable** - Enable the plugin. Defaults to `true`.\n- **priority** - Plugin's priority. Defaults to `10`. Set lower value to set higher priority and vice versa.\n- **verbose** - Verbose output. Defaults to `false`.\n- **exclude** - Exclude files. Support [wildcard](http://www.globtester.com/) pattern(s) in a string or array.\n- **globOptions** - See [globbing](#globbing) section.\n\nFor more options, see [HTMLMinifier](https://github.com/kangax/html-minifier).\n\n## CSS\n\n```yaml\nminify:\n  css:\n    enable: true\n    exclude:\n      - \"*.min.css\"\n```\n\n- **enable** - Enable the plugin. Defaults to `true`.\n- **priority** - Plugin's priority. Defaults to `10`.\n- **verbose** - Verbose output. Defaults to `false`.\n- **exclude** - Exclude files. Support [wildcard](http://www.globtester.com/) pattern(s) in a string or array.\n- **level** - Optimization level. Defaults to `2`.\n- **globOptions** - See [globbing](#globbing) section.\n\nFor more options, see [clean-css](https://github.com/jakubpawlowicz/clean-css).\n\n## JS\n\n```yaml\nminify:\n  js:\n    enable: true\n    exclude:\n      - \"*.min.js\"\n```\n\n- **enable** - Enable the plugin. Defaults to `true`.\n- **priority** - Plugin's priority. Defaults to `10`.\n- **verbose** - Verbose output. Defaults to `false`.\n- **exclude** - Exclude files. Support [wildcard](http://www.globtester.com/) pattern(s) in a string or array.\n- **compress** - Compress options.\n- **mangle** - Mangle variable names. Defaults to `true`. Pass an object to specify [mangle options](https://github.com/terser-js/terser#mangle-options).\n- **output** - Output options.\n  - To retain comments, `output: {comments: true}`.\n- **globOptions** - See [globbing](#globbing) section.\n\nFor more options, see [Terser](https://github.com/terser-js/terser).\n\n## SVG\n\n```yaml\nminify:\n  svg:\n    enable: true\n    include:\n      - \"*.svg\"\n      - \"!*.min.svg\"\n```\n\n- **enable** - Enable the plugin. Defaults to `true`.\n- **priority** - Plugin's priority. Defaults to `10`.\n- **verbose** - Verbose output. Defaults to `false`.\n- **include** - Include files. Support [wildcard](http://www.globtester.com/) pattern(s) in a string or array.\n  - Exclude `*.min.svg` by default.\n- **plugins** - Plugin options.\n  - Examples:\n  ```yaml\n  plugins:\n    # Retain comments\n    removeComments: false\n    # Do not remove unused ID attributes\n    cleanupIds: false\n  ```\n  - For more options, see [svgo](https://github.com/svg/svgo).\n- **globOptions** - See [globbing](#globbing) section.\n\n## XML\n\nRemove whitespaces in xml.\n\n```yaml\nminify:\n  xml:\n    enable: false\n    include:\n      - \"*.xml\"\n      - \"!*.min.xml\"\n```\n\n- **enable** - Enable the plugin. Defaults to `false`.\n- **priority** - Plugin's priority. Defaults to `10`.\n- **verbose** - Verbose output. Defaults to `false`.\n- **include** - Include files. Support [wildcard](http://www.globtester.com/) pattern(s) in a string or array.\n  - Exclude `*.min.xml` by default.\n- **removeComments** - Remove [comments](https://developer.mozilla.org/en-US/docs/Web/XML/XML_introduction) in xml. Defaults to `true`.\n- **globOptions** - See [globbing](#globbing) section.\n\nFor more options, see [minify-xml](https://github.com/kristian/minify-xml#options).\n\n## JSON\n\nRemove whitespaces in json.\n\n```yaml\nminify:\n  json:\n    enable: false\n    include:\n      - \"*.json\"\n      - \"!*.min.json\"\n```\n\n- **enable** - Enable the plugin. Defaults to `false`.\n- **priority** - Plugin's priority. Defaults to `10`.\n- **verbose** - Verbose output. Defaults to `false`.\n- **include** - Include files. Support [wildcard](http://www.globtester.com/) pattern(s) in a string or array.\n  - Exclude `*.min.json` by default.\n- **globOptions** - See [globbing](#globbing) section.\n\n## Gzip\n\n```yaml\nminify:\n  gzip:\n    enable: true\n    include:\n      - \"*.html\"\n      - \"*.css\"\n      - \"*.js\"\n      - \"*.txt\"\n      - \"*.ttf\"\n      - \"*.atom\"\n      - \"*.stl\"\n      - \"*.xml\"\n      - \"*.svg\"\n      - \"*.eot\"\n      - \"*.json\"\n```\n\n- **enable** - Enable the plugin. Defaults to `true`.\n- **priority** - Plugin's priority. Defaults to `10`.\n- **verbose** - Verbose output. Defaults to `false`.\n- **include** - Include files. Support [wildcard](http://www.globtester.com/) pattern(s) in a string or array.\n  - Support one-liner, `include: ['*.html','*.css','*.js']`.\n  - Must include asterisk and single quotes. `.html` is invalid. `'*.html'` is valid.\n- **globOptions** - See [globbing](#globbing) section.\n- **level** - Compression level; lower value may results in faster compression but slightly larger (compressed) file. Range `1-9`. Defaults to `9`, or the value of [`zlib.constants.Z_BEST_COMPRESSION`](https://nodejs.org/docs/latest-v12.x/api/zlib.html#zlib_zlib_constants)\n\n## Brotli\n\n```yaml\nminify:\n  brotli:\n    enable: true\n    include:\n      - \"*.html\"\n      - \"*.css\"\n      - \"*.js\"\n      - \"*.txt\"\n      - \"*.ttf\"\n      - \"*.atom\"\n      - \"*.stl\"\n      - \"*.xml\"\n      - \"*.svg\"\n      - \"*.eot\"\n      - \"*.json\"\n```\n\n- **enable** - Enable the plugin. Defaults to `true`.\n- **priority** - Plugin's priority. Defaults to `10`.\n- **verbose** - Verbose output. Defaults to `false`.\n- **include** - Include files. Support [wildcard](http://www.globtester.com/) pattern(s) in a string or array.\n- **globOptions** - See [globbing](#globbing) section.\n- **level** - Compression level. Range `1-11`. Defaults to `11`, or the value of [`zlib.constants.BROTLI_MAX_QUALITY`](https://nodejs.org/docs/latest-v12.x/api/zlib.html#zlib_brotli_constants)\n\n## Zstd\n\n```yaml\nminify:\n  zstd:\n    enable: false\n    include:\n      - \"*.html\"\n      - \"*.css\"\n      - \"*.js\"\n      - \"*.txt\"\n      - \"*.ttf\"\n      - \"*.atom\"\n      - \"*.stl\"\n      - \"*.xml\"\n      - \"*.svg\"\n      - \"*.eot\"\n      - \"*.json\"\n```\n\n- **enable** - Enable the plugin. Defaults to `false`.\n- **priority** - Plugin's priority. Defaults to `10`.\n- **verbose** - Verbose output. Defaults to `false`.\n- **include** - Include files. Support [wildcard](http://www.globtester.com/) pattern(s) in a string or array.\n- **globOptions** - See [globbing](#globbing) section.\n- **level** - Compression level. Range `1-22`. Defaults to `3`, or the value of [`DEFAULT_LEVEL`](https://github.com/mongodb-js/zstd/blob/a3a08c61c9045411c8275e248498dbc583457fb5/src/lib.rs#L9)\n\n## Globbing\n\nUse \"globOptions\" to customise how glob patterns match files. Refer to [micromatch](https://github.com/micromatch/micromatch#options) for available options.\n\n- basename is enabled by default, unless the pattern has a slash.\n- basename is disabled depending on each pattern.\n- This means the following options would work,\n\n```yml\nexclude:\n  - \"*foo.html\" # basename is enabled\n  - \"**/bar/*/*.html\" # basename is automatically disabled\n  - \"*baz.css\" # basename is enabled\nglobOptions:\n  basename: true # default\n```\n\n- This behaviour doesn't apply to pattern that starts with `!` (negation).\n- This limitation only applies to `include:` option used in svg, gzip and brotli.\n- This means the following options would _not_ work,\n\n```yml\ninclude:\n  - \"!foo.svg\"\n  - \"!**/bar/*/*.svg\"\nglobOptions:\n  basename: true\n```\n\n- basename will stay disabled, if explicitly disabled in \"globOptions\".\n\n## Credits\n\nAll credits go to the following work:\n\n- [hexo-neat](https://github.com/rozbo/hexo-neat) by rozbo\n- gzip feature is inspired by [hexo-generator-optimize](https://github.com/JackyRen/hexo-generator-optimize)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcurbengh%2Fhexo-yam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcurbengh%2Fhexo-yam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcurbengh%2Fhexo-yam/lists"}