{"id":13692846,"url":"https://github.com/alexjlockwood/avocado","last_synced_at":"2025-05-15T14:02:11.245Z","repository":{"id":37743315,"uuid":"110750022","full_name":"alexjlockwood/avocado","owner":"alexjlockwood","description":"🥑 Vector Drawable optimization tool 🥑","archived":false,"fork":false,"pushed_at":"2020-04-29T22:14:34.000Z","size":344,"stargazers_count":1356,"open_issues_count":32,"forks_count":47,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-05-12T22:51:59.179Z","etag":null,"topics":["android","animated-vector-drawable","vector-drawable"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/alexjlockwood.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":"2017-11-14T22:01:45.000Z","updated_at":"2025-04-07T17:17:40.000Z","dependencies_parsed_at":"2022-08-28T13:00:31.698Z","dependency_job_id":null,"html_url":"https://github.com/alexjlockwood/avocado","commit_stats":null,"previous_names":["alexjlockwood/avdo"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexjlockwood%2Favocado","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexjlockwood%2Favocado/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexjlockwood%2Favocado/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexjlockwood%2Favocado/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexjlockwood","download_url":"https://codeload.github.com/alexjlockwood/avocado/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254355321,"owners_count":22057352,"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":["android","animated-vector-drawable","vector-drawable"],"created_at":"2024-08-02T17:01:02.610Z","updated_at":"2025-05-15T14:02:10.780Z","avatar_url":"https://github.com/alexjlockwood.png","language":"TypeScript","funding_links":[],"categories":["Development","TypeScript"],"sub_categories":[],"readme":"# avocado\n\n[![Build status][travis-badge]][travis-badge-url]\n[![npm version][npm-badge]][npm-badge-url]\n[![Coverage status][coveralls-badge]][coveralls-badge-url]\n\n`avocado` is a command line tool (similar to [`svgo`][svgo]) that optimizes Android\n`VectorDrawable` (VD) and `AnimatedVectorDrawable` (AVD) xml files.\n\n## Installation\n\nYou can install `avocado` using [npm][npm] w/ the following command:\n\n```sh\nnpm install -g avocado\n```\n\n## Usage\n\n```text\nUsage: avocado [options] [file]\n\nOptions:\n\n  -V, --version          output the version number\n  -s, --string \u003cstring\u003e  input VD or AVD string\n  -i, --input \u003cfile\u003e     input file/directory, or \"-\" for STDIN\n  -o, --output \u003cfile\u003e    output file/directory (same as the input file by default), or \"-\" for STDOUT\n  -d, --dir \u003cdir\u003e        optimizes and rewrite all *.xml files in a directory\n  -q, --quiet            only output error messages\n  -h, --help             output usage information\n```\n\n### Examples\n\n```sh\n# Optimize (and overwrite) a VD/AVD file.\navocado vector.xml\n\n# Optimize (and overwrite) multiple VD/AVD files.\navocado *.xml\n\n# Optimize a VD/AVD file and write the output to a new file.\navocado vector.xml -o vector_min.xml\n\n# Optimize a VD/AVD using standard input and standard output.\ncat vector.xml | avocado -i - -o - \u003e vector_min.xml\n\n# Optimize (and overwrite) all of the VD/AVD files in a directory.\navocado -d path/to/directory\n\n# Optimize all VD/AVD files in a directory and write them to a new directory.\navocado -d path/to/input/directory -o path/to/output/directory\n\n# Optimize all files ending with '.xml' and write them to a new directory.\navocado *.xml -o path/to/output/directory\n\n# Pass a string as input and write the output to a new file.\navocado -s '\u003cvector\u003e...\u003c/vector\u003e' -o vector_min.xml\n```\n\n`avocado` rewrites the `VectorDrawable` using the smallest number of `\u003cgroup\u003e`s and `\u003cpath\u003e`s possible, reducing their file sizes and making them faster to parse and draw at runtime. The example below shows the contents of a `VectorDrawable` before and after being run through `avocado`.\n\n#### Before\n\n```xml\n\u003cvector xmlns:android=\"http://schemas.android.com/apk/res/android\" android:width=\"108dp\" android:height=\"108dp\" android:viewportHeight=\"108\" android:viewportWidth=\"108\"\u003e\n  \u003cpath android:fillColor=\"#26A69A\" android:pathData=\"M0,0h108v108h-108z\" /\u003e\n  \u003cgroup android:pivotX=\"54\" android:pivotY=\"54\" android:scaleX=\"1.5\" android:scaleY=\"1.5\"\u003e\n    \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M9,0L9,108\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n    \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M19,0L19,108\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n    \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M29,0L29,108\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n    \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M39,0L39,108\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n    \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M49,0L49,108\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n    \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M59,0L59,108\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n  \u003c/group\u003e\n  \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M69,0L69,108\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n  \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M79,0L79,108\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n  \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M89,0L89,108\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n  \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M99,0L99,108\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n  \u003cgroup android:translateX=\"54\" android:translateY=\"54\"\u003e\n    \u003cgroup android:pivotX=\"54\" android:pivotY=\"54\" android:rotation=\"180\"\u003e\n      \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M0,9L108,9\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n      \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M0,19L108,19\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n      \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M0,29L108,29\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n      \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M0,39L108,39\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n      \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M0,49L108,49\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n      \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M0,59L108,59\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n    \u003c/group\u003e\n    \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M0,69L108,69\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n    \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M0,79L108,79\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n    \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M0,89L108,89\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n    \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M0,99L108,99\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n    \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M19,29L89,29\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n    \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M19,39L89,39\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n    \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M19,49L89,49\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n    \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M19,59L89,59\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n    \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M19,69L89,69\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n    \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M19,79L89,79\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n    \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M29,19L29,89\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n    \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M39,19L39,89\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n    \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M49,19L49,89\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n    \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M59,19L59,89\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n    \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M69,19L69,89\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n    \u003cpath android:fillColor=\"#00000000\" android:pathData=\"M79,19L79,89\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\" /\u003e\n  \u003c/group\u003e\n\u003c/vector\u003e\n```\n\n#### After\n\n```xml\n\u003cvector xmlns:android=\"http://schemas.android.com/apk/res/android\" android:width=\"108dp\" android:height=\"108dp\" android:viewportHeight=\"108\" android:viewportWidth=\"108\"\u003e\n    \u003cpath android:fillColor=\"#26A69A\" android:pathData=\"M0 0h108v108H0z\"/\u003e\n    \u003cpath android:pathData=\"M-13.5-27v162m15-162v162m15-162v162m15-162v162m15-162v162m15-162v162M69 0v108M79 0v108M89 0v108M99 0v108m63 63h108m-108 10h108m-108 10h108m-108 10h108m-108 10h108m-108 10h108M54 123h108M54 133h108M54 143h108M54 153h108M73 83h70M73 93h70m-70 10h70m-70 10h70m-70 10h70m-70 10h70M83 73v70m10-70v70m10-70v70m10-70v70m10-70v70m10-70v70\" android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/\u003e\n\u003c/vector\u003e\n\n```\n\n## Build instructions\n\nIf you want to contribute, first be sure to install the latest version of\n[`Node.js`](https://nodejs.org/) and [`npm`](https://www.npmjs.com/).\nIf you're not sure what IDE to use, I highly recommend checking out\n[vscode][vscode].\n\nThen clone this repository and in the root directory, run:\n\n```sh\nnpm install\n```\n\nTo build the tool, run:\n\n```sh\nnpm run build\n```\n\nTo test the tool, run:\n\n```sh\nnpm run test\n```\n\n  [travis-badge]: https://travis-ci.org/alexjlockwood/avocado.svg?branch=master\n  [travis-badge-url]: https://travis-ci.org/alexjlockwood/avocado\n  [coveralls-badge]: https://coveralls.io/repos/github/alexjlockwood/avocado/badge.svg?branch=master\n  [coveralls-badge-url]: https://coveralls.io/github/alexjlockwood/avocado?branch=master\n  [npm-badge]: https://badge.fury.io/js/avocado.svg\n  [npm-badge-url]: https://www.npmjs.com/package/avocado\n  [svgo]: https://github.com/svg/svgo\n  [vscode]: https://code.visualstudio.com/\n  [npm]: https://www.npmjs.com/get-npm\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexjlockwood%2Favocado","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexjlockwood%2Favocado","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexjlockwood%2Favocado/lists"}