Skip to content

Latest commit

 

History

History
112 lines (102 loc) · 2.47 KB

vscode.md

File metadata and controls

112 lines (102 loc) · 2.47 KB

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:

{
  // 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)”:

// Place your key bindings in this file to override the defaults
[
  {
    "key": "ctrl+l",
    "command": "workbench.action.tasks.runTask",
    "args": "optimizt: Optimize Image (lossless)"
  }
]