# Visual Studio Code: Integrating Optimizt with "Tasks" ## Add a Task Using the _Command Palette_, select `>Tasks: Open User Tasks`. In the opened file, add the desired tasks to the `tasks` array, for example: ```javascript { // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ { "label": "optimizt: Optimize Image", "type": "shell", "command": "optimizt", "args": [ "--verbose", { "value": "${file}", "quoting": "strong" } ], "presentation": { "echo": false, "showReuseMessage": false, "clear": true } }, { "label": "optimizt: Optimize Image (lossless)", "type": "shell", "command": "optimizt", "args": [ "--lossless", "--verbose", { "value": "${file}", "quoting": "strong" } ], "presentation": { "echo": false, "showReuseMessage": false, "clear": true } }, { "label": "optimizt: Create WebP", "type": "shell", "command": "optimizt", "args": [ "--webp", "--verbose", { "value": "${file}", "quoting": "strong" } ], "presentation": { "echo": false, "showReuseMessage": false, "clear": true } }, { "label": "optimizt: Create WebP (lossless)", "type": "shell", "command": "optimizt", "args": [ "--webp", "--lossless", "--verbose", { "value": "${file}", "quoting": "strong" } ], "presentation": { "echo": false, "showReuseMessage": false, "clear": true } } ] } ``` ## How to Use 1. Open the file you want to process with Optimizt; it should be in the active tab. 2. Using the _Command Palette_, select `>Tasks: Run Task`. 3. Choose the task you want to run. ## Keyboard Shortcuts To add a keyboard shortcut for a task, choose `>Preferences: Open Keyboard Shortcuts (JSON)` in the _Command Palette_. Here’s an example of adding a keyboard shortcut to run the task “optimizt: Optimize Image (lossless)”: ```javascript // Place your key bindings in this file to override the defaults [ { "key": "ctrl+l", "command": "workbench.action.tasks.runTask", "args": "optimizt: Optimize Image (lossless)" } ] ```