{"id":13536596,"url":"https://github.com/theme-next/hexo-filter-optimize","last_synced_at":"2025-07-10T00:32:26.643Z","repository":{"id":57263354,"uuid":"118434430","full_name":"theme-next/hexo-filter-optimize","owner":"theme-next","description":"A Hexo plugin that optimize the pages loading speed.","archived":false,"fork":false,"pushed_at":"2020-03-22T09:20:13.000Z","size":73,"stargazers_count":45,"open_issues_count":1,"forks_count":2,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-11-03T01:33:18.010Z","etag":null,"topics":["filter","hexo","hexo-plugin","optimize","plugin"],"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/theme-next.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}},"created_at":"2018-01-22T09:21:34.000Z","updated_at":"2024-10-16T18:45:19.000Z","dependencies_parsed_at":"2022-09-02T05:23:41.842Z","dependency_job_id":null,"html_url":"https://github.com/theme-next/hexo-filter-optimize","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theme-next%2Fhexo-filter-optimize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theme-next%2Fhexo-filter-optimize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theme-next%2Fhexo-filter-optimize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theme-next%2Fhexo-filter-optimize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theme-next","download_url":"https://codeload.github.com/theme-next/hexo-filter-optimize/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225606632,"owners_count":17495551,"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":["filter","hexo","hexo-plugin","optimize","plugin"],"created_at":"2024-08-01T09:00:45.147Z","updated_at":"2024-11-20T17:56:54.643Z","avatar_url":"https://github.com/theme-next.png","language":"JavaScript","readme":"# hexo-filter-optimize\n\n[![travis-image]][travis-url]\n[![npm-image]][npm-url]\n[![lic-image]](LICENSE)\n\nA hexo plugin that optimize the pages loading speed.\n\nIt will auto filter your html file, find the `\u003clink rel=\"stylesheet\"\u003e` block and replace them into a javascript to [optimize CSS delivery](https://developers.google.com/speed/docs/insights/OptimizeCSSDelivery).\n\nAnd inline the `main.css` into the html page like [@maple3142 does](https://github.com/maple3142/Blog/blob/master/gulpfile.js).\n\nIt will improve your pages loading and get a higher score in the [Google PageSpeed Insights](https://developers.google.com/speed/pagespeed/insights/).\n\n**Known Issues:** This plugin may cause Font Awesome and PJAX to fail to load.\n\n## Installation\n\n![size-image]\n[![dm-image]][npm-url]\n[![dt-image]][npm-url]\n\n```bash\nnpm install hexo-filter-optimize\n```\n\n## Usage\n\nActivate the plugin in hexo's `_config.yml` like this:\n```yml\nfilter_optimize:\n  enable: true\n  # remove the surrounding comments in each of the bundled files\n  remove_comments: false\n  css:\n    # minify all css files\n    minify: true\n    # bundle loaded css files into one\n    bundle: true\n    # use a script block to load css elements dynamically\n    delivery: true\n    # make specific css content inline into the html page\n    #   - only support the full path\n    #   - default is ['css/main.css']\n    inlines:\n    excludes:\n  js:\n    # minify all js files\n    minify: true\n    # bundle loaded js files into one\n    bundle: true\n    excludes:\n  # set the priority of this plugin,\n  # lower means it will be executed first, default of Hexo is 10\n  priority: 12\n```\n\nThis plugin can be disabled by `NODE_ENV` in development to boost `hexo generate`:\n```\nexport NODE_ENV=development\n```\n\n## Comparison\n\nHere is a [result](https://gtmetrix.com/compare/Z7BnLaPX/qSMKtzBY) from [GTmetrix](https://gtmetrix.com) to show you the changes between before and after. (Same web server located in Tokyo, Japan, vultr.com)\n\n* **Remove query strings from static resources** - let all the proxies could cache resources well. (https://gtmetrix.com/remove-query-strings-from-static-resources.html)\n* **Make fewer HTTP requests** - through combined the loaded js files into the one.\n* **Prefer asynchronous resources** - change the css delivery method using a script block instead of link tag.\n* And TODOs ...\n\n![Comparison](https://user-images.githubusercontent.com/980449/35233293-a8229c72-ffd8-11e7-8a23-3b8bc10d40c3.png)\n\n[travis-image]: https://img.shields.io/travis/theme-next/hexo-filter-optimize/master.svg?style=flat-square\n[npm-image]: https://img.shields.io/npm/v/hexo-filter-optimize.svg?style=flat-square\n[lic-image]: https://img.shields.io/npm/l/hexo-filter-optimize?style=flat-square\n\n[size-image]: https://img.shields.io/github/languages/code-size/theme-next/hexo-filter-optimize?style=flat-square\n[dm-image]: https://img.shields.io/npm/dm/hexo-filter-optimize?style=flat-square\n[dt-image]: https://img.shields.io/npm/dt/hexo-filter-optimize?style=flat-square\n\n[travis-url]: https://travis-ci.org/theme-next/hexo-filter-optimize\n[npm-url]: https://www.npmjs.com/package/hexo-filter-optimize\n","funding_links":[],"categories":["Plugins"],"sub_categories":["Hexo Plugins"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheme-next%2Fhexo-filter-optimize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheme-next%2Fhexo-filter-optimize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheme-next%2Fhexo-filter-optimize/lists"}