/tinify-cli

Command tool for compress and convert image

Primary LanguageTypeScriptMIT LicenseMIT

@tinify_cli/cli

Downloads Version GitHub license PRs Welcome

A compress image resource cli tool througth by tinify.

Why

  • Convert other image type to webp
  • Compress any image files in your local
  • Watch mode, it can listen the assets dir, and auto execute convert or compress action

Install

$ npm install @tinify_cli/cli -g

Set up

First of all, it need get tinify token. Copy it to your env file(like ~/.zshrc in Mac OSX):

# ~/.zshrc
$ export TINIFY_TOKEN=xxxxxxx

Finally, execute the command:

$ source ~/.zshrc

Usage

Compress

$ tinify compress --name=[YOUR_IMAGE_PATH]

Generate to Webp

$ tinify generate --name=[YOUR_IMAGE_PATH]

Common options

--all

short: -a

Transform all files in the directory.

--watch

short: -w

Watch mode, the transform action wont't act immediately when the command is executed.

--name

short: -n

The name of the file to transform.

Note: With this option, the --all will be invalid.

--cwd

short: -c

The working directory of where @tinify_cli/cli command will be executed in, all other paths options are relative to this path.

--dir

short: -d

The directory to transform.

--output

short: -o

The directory to store the transformed files.