{"id":20802307,"url":"https://github.com/ulyanov-programmer/grunt-sharp-optimize","last_synced_at":"2026-01-18T21:32:31.696Z","repository":{"id":228733842,"uuid":"774775344","full_name":"Ulyanov-programmer/grunt-sharp-optimize","owner":"Ulyanov-programmer","description":"Compression and conversion of images for grunt using sharp.","archived":false,"fork":false,"pushed_at":"2024-08-07T11:51:03.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-30T10:02:52.852Z","etag":null,"topics":["grunt","grunt-plugin","js","sharp"],"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/Ulyanov-programmer.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-20T06:50:59.000Z","updated_at":"2024-08-07T11:49:37.000Z","dependencies_parsed_at":"2024-09-18T20:43:43.300Z","dependency_job_id":null,"html_url":"https://github.com/Ulyanov-programmer/grunt-sharp-optimize","commit_stats":null,"previous_names":["ulyanov-programmer/grunt-sharp-optimize"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ulyanov-programmer%2Fgrunt-sharp-optimize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ulyanov-programmer%2Fgrunt-sharp-optimize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ulyanov-programmer%2Fgrunt-sharp-optimize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ulyanov-programmer%2Fgrunt-sharp-optimize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ulyanov-programmer","download_url":"https://codeload.github.com/Ulyanov-programmer/grunt-sharp-optimize/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247108987,"owners_count":20885013,"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":["grunt","grunt-plugin","js","sharp"],"created_at":"2024-11-17T18:29:30.161Z","updated_at":"2026-01-18T21:32:31.690Z","avatar_url":"https://github.com/Ulyanov-programmer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# grunt-sharp-optimize\n\n\u003e Compression and conversion of images for grunt using [sharp](https://www.npmjs.com/package/sharp).\n\n## What is this\n\n### With this thing you can: \u003cbr\u003e\n\n- Optimize your images.\n- Convert your images to other formats (including, but not limited to `.webp` and `.avif`).\n\n### Features\n\n- Using the [sharp](https://www.npmjs.com/package/sharp) plugin.\n- A beautiful log system.\n- Flexible API.\n- Supported formats: `.png .jpg/jpeg .webp .avif .tiff .heif .gif`\n\n## How to use this\n\n### Installation\n\nIf you haven't used [Grunt](https://gruntjs.com/) before, be sure to check out the [Getting Started](https://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](https://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:\n\n```shell\nnpm i grunt-sharp-optimize\n```\n\n_OR_\n\n```shell\nyarn add grunt-sharp-optimize\n```\n\nOnce the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:\n\n```js\ngrunt.loadNpmTasks('grunt-sharp-optimize');\n```\n\nOr use [the load-grunt-tasks plugin](https://www.npmjs.com/package/load-grunt-tasks).\n\n---\n\n### Example of usage\n\n```js\ngrunt.initConfig({\n  sharp: {\n    files: {\n      src: 'your_src_images/**/*.{gif,webp,avif,png,jpg,jpeg,svg}',\n      dest: 'your_dest_images/',\n    },\n    options: {\n      logLevel: 'small',\n\n      webp: {\n        quality: 80,\n        lossless: false,\n        alsoProcessOriginal: true,\n      },\n\n      avif: {\n        quality: 100,\n        lossless: true,\n        effort: 4,\n      },\n\n      gif_to_webp: {\n        quality: 90,\n      },\n\n      png_to_avif: {},\n\n      jpg_to_jpg: {\n        quality: 80,\n        mozjpeg: true,\n      },\n    },\n  },\n});\n```\n\n## ⚠ Pay attention\n\nUsing this plugin together with the [grunt-newer plugin](https://www.npmjs.com/package/grunt-newer) and the like may not allow it to work correctly. This plugin **has a built-in system that replaces the functionality of similar plugins**.\n\n## API\n\n```js\nsharp: {\n  ...,\n  options: {\n    sharpOptions: {},\n    logLevel: 'codename',\n\n    extname: {\n      param: value,\n    },\n    extname_to_extname: {\n      param: value,\n    },\n  },\n}\n```\n\n### extname\n\nType: `object`\u003cbr\u003e\nAn object that allows you to convert `all` images into images of a `specific type`.\n\u003cbr\u003e\n\n```js\n// example, all images will be converted to .avif\navif: {\n  param: value,\n},\n```\n\n#### param\n\nType: `any` (depends on the parameter)\u003cbr\u003e\nOption for an output image. \u003cbr\u003e\nTo familiarize yourself with the available options, refer to the plugin documentation (for example, this [section for `.jpeg`](https://sharp.pixelplumbing.com/api-output#jpeg)):\n\n#### alsoProcessOriginal\n\nType: `boolean`\u003cbr\u003e\nDefault value: `false`\u003cbr\u003e\nIt also allows you to optimize and move the original files. It only works for the type `extname: {}` parameter. \u003cbr\u003e\n\n```js\navif: {\n  // If true, the originals will also be optimized and transferred.\n  alsoProcessOriginal: true,\n},\n```\n\n### extname_to_extname\n\nType: `object`\u003cbr\u003e\nAn object that allows you to convert images of a `specific type` into images of a `specific type`. \u003cbr\u003e\n_Does not transmit originals._ \u003cbr\u003e\n\n```js\n// example, all images in the format .jpg will be converted to .avif\njpg_to_avif: {\n  param: value,\n},\n// you can also optimize images without changing the extension\njpg_to_jpg: {\n  param: value,\n},\n```\n\n### logLevel\n\nType: `string`\u003cbr\u003e\nDefault value: `small`\u003cbr\u003e\nCan get the value: `small | full | ''`\u003cbr\u003e\nAllows you to change the logging.\n\n```js\n// usage example\noptions: {\n  logLevel: 'full',\n  ...,\n}\n```\n\n```bash\n// Log if the value of logLevel is equal to 'small' (default value):\nyourImage.jpg =\u003e webp\n\n// Log if the value of logLevel is equal to 'full':\nThe file the_absolute_path_to_your/image.jpg was processed to image.webp\n\n// Log if the value of logLevel is equal to '' (or other value):\n\n(the log is disabled)\n```\n\n### sharpOptions\n\nType: `object`\u003cbr\u003e\nIf you need to pass certain [parameters](https://sharp.pixelplumbing.com/api-constructor#new) directly to the sharp plugin, use this parameter.\n\n```js\n// usage example\noptions: {\n  sharpOptions: {\n    animated: true,\n    limitInputPixels: false,\n  },\n  ...,\n}\n```\n\n### Supported format names:\n\n- `png`\n- `jpg` | `jpeg`\n- `webp`\n- `avif`\n- `tiff`\n- `heif`\n- `gif`\n\n### If you find a bug, please create an issue [here](https://github.com/Ulyanov-programmer/grunt-sharp-optimize/issues).\n\n### If this project was useful to you, you can give it a ★ in [repository](https://github.com/Ulyanov-programmer/grunt-sharp-optimize).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fulyanov-programmer%2Fgrunt-sharp-optimize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fulyanov-programmer%2Fgrunt-sharp-optimize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fulyanov-programmer%2Fgrunt-sharp-optimize/lists"}