{"id":17967604,"url":"https://github.com/hexojs/hexo-asset-pipeline","last_synced_at":"2025-03-25T08:31:22.134Z","repository":{"id":22125917,"uuid":"95206573","full_name":"hexojs/hexo-asset-pipeline","owner":"hexojs","description":"A hexo plugin to minify/optimize HTML, CSS, JS and images. Supports revisioning of assets.","archived":true,"fork":false,"pushed_at":"2022-07-24T09:38:32.000Z","size":96,"stargazers_count":29,"open_issues_count":27,"forks_count":16,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-29T15:49:12.728Z","etag":null,"topics":["assets","clean-css","css","hexo","hexo-asset-pipeline","hexo-plugin","html-minifier","imagemin","javascript","optimization","revisioning","stylesheets","uglifyjs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hexojs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-23T09:42:21.000Z","updated_at":"2023-01-27T22:51:10.000Z","dependencies_parsed_at":"2022-09-01T04:31:57.951Z","dependency_job_id":null,"html_url":"https://github.com/hexojs/hexo-asset-pipeline","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexojs%2Fhexo-asset-pipeline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexojs%2Fhexo-asset-pipeline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexojs%2Fhexo-asset-pipeline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexojs%2Fhexo-asset-pipeline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hexojs","download_url":"https://codeload.github.com/hexojs/hexo-asset-pipeline/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245426256,"owners_count":20613319,"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":["assets","clean-css","css","hexo","hexo-asset-pipeline","hexo-plugin","html-minifier","imagemin","javascript","optimization","revisioning","stylesheets","uglifyjs"],"created_at":"2024-10-29T14:09:09.454Z","updated_at":"2025-03-25T08:31:21.776Z","avatar_url":"https://github.com/hexojs.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# DEPRECATED!\n\nhexo-asset-pipeline has been deprecated.\n\n# hexo-asset-pipeline\n\n[![Dependency Status](https://david-dm.org/hexojs/hexo-asset-pipeline/status.svg?style=flat)](https://david-dm.org/hexojs/hexo-asset-pipeline)\n[![npm version](https://badge.fury.io/js/hexo-asset-pipeline.svg)](https://www.npmjs.com/package/hexo-asset-pipeline)\n[![GitHub issues](https://img.shields.io/github/issues/hexojs/hexo-asset-pipeline.svg)](https://github.com/hexojs/hexo-asset-pipeline/issues)\n\nAsset pipeline for [Hexo](https://hexo.io/) to support minification and optimization of HTML, CSS, JS and images.\n- Hexo 3.x.x\n\n## Installation\n``` bash\n$ npm install hexo-asset-pipeline --save\n```\n## Configuration\nAdd the following snippet in `_config.yml`.\n\nMinimal config to enable filters for HTML, CSS, Js and images.\n```yaml\nasset_pipeline:\n  revisioning:\n    enable: true\n  clean_css:\n    enable: true\n  uglify_js:\n    enable: true\n  imagemin:\n    enable: true\n  html_minifier:\n    enable: true\n```\n- **revisioning** - Enabling revisioning of assets..\n- **clean_css** - Adding options for [clean-css](https://www.npmjs.com/package/clean-css).\n- **uglify_js** - Adding options for [uglify-js](https://www.npmjs.com/package/uglify-js).\n- **imagemin** - Adding options for [imagemin](https://www.npmjs.com/package/imagemin).\n- **html_minifier** - Adding options for [html-minifier](https://www.npmjs.com/package/html-minifier).\n\n## Components\nFollowing are the modules that are being used to process differnet types of assets.\n\n### HTML (html_minifier)\n[html-minifier](https://www.npmjs.com/package/html-minifier) is used to minify the HTML files.\n\nFollowing is the config for html-minifier.\n\n#### Options\n``` yaml\nhtml_minifier:\n  enable: true\n  ignore_error: false\n  exclude:\n```\n- **enable** - Enable the plugin. Defaults to `false`.\n- **ignore_error** - Ignore the error occurred on parsing html\n- **exclude**: Exclude files\n\n#### html_minifier defaults\n```yaml\nhtml_minifier:\n  ignoreCustomComments: [/^\\s*more/]\n  removeComments: true\n  removeCommentsFromCDATA: true\n  collapseWhitespace: true\n  collapseBooleanAttributes: true\n  removeEmptyAttributes: true\n  minifyJS: true\n  minifyCSS: true\n```\n\n**Note**: Check [html-minifier](https://www.npmjs.com/package/html-minifier#options-quick-reference) for more options.\n\n### Javascripts (uglify_js)\n[uglify-js](https://www.npmjs.com/package/uglify-js) is used to minify javascripts.\n\nFollowing is the config for uglify-js.\n#### Options\n``` yaml\nuglify_js:\n  enable: true\n  mangle: true\n  output:\n  compress:\n  exclude: \n    - '*.min.js'\n```\n- **enable** - Enable the plugin. Defaults to `false`.\n- **mangle**: Mangle file names\n- **output**: Output options\n- **compress**: Compress options\n- **exclude**: Exclude files\n\n#### uglify-js defaults\n```yaml\nuglify_js:\n  mangle: true\n  exclude: ['*.min.js']\n```\n\n**Note**: Check [uglify-js](https://www.npmjs.com/package/uglify-js#minify-options) for more options.\n\n### Stylesheets (clean_css)\n[clean-css](https://www.npmjs.com/package/clean-css) is used to minify stylesheets.\n\nFollowing is the config for clean-css.\n#### Options\n``` yaml\nclean_css:\n  enable: true\n  exclude: \n    - '*.min.css'\n```\n- **enable** - Enable the plugin. Defaults to `false`.\n- **exclude**: Exclude files\n\n#### clean-css defaults\n```yaml\nclean_css:\n  exclude: ['*.min.css']\n```\n\n**Note**: Check [clean-css](https://www.npmjs.com/package/clean-css#use) for more options.\n\n### Images (imagemin)\n[imagemin](https://www.npmjs.com/package/imagemin) is used to optimize images.\n\nFollowing is the config for imagemin.\n#### Options\n```yaml\nimagemin:\n  enable: true\n  interlaced: false\n  multipass: false\n  optimizationLevel: 2\n  pngquant: false\n  progressive: false\n```\n- **enable** - Enable the plugin. Defaults to `false`.\n- **interlaced** - Interlace gif for progressive rendering. Defaults to `false`.\n- **multipass** - Optimize svg multiple times until it’s fully optimized. Defaults to `false`.\n- **optimizationLevel** - Select an optimization level between 0 and 7. Defaults to `2`.\n- **pngquant** - Enable [imagemin-pngquant](https://github.com/imagemin/imagemin-pngquant) plugin. Defaults to `false`.\n- **progressive** - Lossless conversion to progressive. Defaults to `false`.\n- **exclude** - Exclude specific types of image files, the input value could be `gif`,`jpg`, `png`, or `svg`. Default to null.\n\n#### imagemin defaults\n```yaml\nimagemin:\n  interlaced: false\n  multipass: false\n  optimizationLevel: 3\n  pngquant: false\n  progressive: false\n```\n\n**Note**: Check [imagemin plugins](https://www.npmjs.com/package/imagemin#plugins) for more options.\n\n### Revisioning\n```yaml\nrevisioning:\n  enable: true\n  keep: true\n  exclude: ['robots.txt', '*.json']\n  selectors:\n    'img[data-orign]':  data-orign\n    'img[data-src]': 'data-src'\n    'img[src]': 'src'\n```\n- **enable** - Enable revisioning of assets. Defaults to `false`.\n- **keep** - Keep original assets. Defaults to `false`.\n- **exclude** - Exclude files from revisioning.\n- **selectors** - It is used so that custom implementations can be processed. Any attribute matching the key should have the asset url in the value. For instance in above example any element matching to `img[data-orign]` will have the URL for asset in `data-origin` attribute, this specific case can be helpful for [jquery lazyload](https://github.com/tuupola/jquery_lazyload) implementations.\n\n#### Revisioning defaults;\n```yaml\nrevisioning:\n  enable: false\n  keep: false\n  exclude: []\n  selectors:\n    'img[data-src]': 'data-src'\n    'img[src]': 'src'\n    'link[rel=\"apple-touch-icon\"]': 'href'\n    'link[rel=\"icon\"]': 'href'\n    'link[rel=\"shortcut icon\"]': 'href'\n    'link[rel=\"stylesheet\"]': 'href'\n    'script[src]': 'src'\n    'source[src]': 'src'\n    'video[poster]': 'poster'\n```\n\n#### Note: To match paths in `exclude` option, glob matching is done using [micromatch](https://github.com/micromatch/micromatch).\n\n#### TODO\n* Eslint configs\n* Test plugin for relative paths\n* Add option to add CDN\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexojs%2Fhexo-asset-pipeline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhexojs%2Fhexo-asset-pipeline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexojs%2Fhexo-asset-pipeline/lists"}