Using the Command Palette, select >Tasks: Open User Tasks
.
In the opened file, add the desired tasks to the tasks
array, for example:
{
// 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
}
}
]
}
- Open the file you want to process with Optimizt; it should be in the active tab.
- Using the Command Palette, select
>Tasks: Run Task
. - Choose the task you want to run.
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)”:
// Place your key bindings in this file to override the defaults
[
{
"key": "ctrl+l",
"command": "workbench.action.tasks.runTask",
"args": "optimizt: Optimize Image (lossless)"
}
]