Minomax CLI Reference

Minomax CLI provides several commands to optimize, compress, and configure web assets like images, videos, and web documents. The CLI leverages a flexible structure, allowing users to easily integrate it into their workflows.

Commands

1. prod - Run the Minomax Process

This is master command triggers the Minomax optimization process for images, videos and webdocs, also perfoms image set generation and thumbnail linking.

Options:

  • -f, --format [jpg | avif | webp | svg]
    Specifies the output format for images. Default is webp.
  • -c, --codec [wav1 | mav1 | mx265]
    Defines the video codec. Default is wav1.
  • -e, --encode [1 | 2 | 3]
    Sets the video encoding level (1 being low, 3 being high). Default is 3.
  • -i, --ignore <patterns>
    Path patterns to ignore during processing.

Example Usage:

npx minomax prod -f jpg -c wav1 -e 2 -i "node_modules"

2. image - Compress Images

This command compresses images into the specified format.

Options:

  • -p, --patterns <patterns>
    Path patterns to locate source image files.
  • -f, --format [jpg | avif | webp | svg]
    Specifies the image output format. Default is webp.
  • -d, --dest <path>
    The destination folder for the optimized images.
  • -i, --ignore <patterns>
    Path patterns to ignore during image compression.

Example Usage:

npx minomax image -p "src/images/**/*.jpg" -f webp -d "./optimized_images"

3. video - Compress Videos

This command compresses videos into the specified codec and encoding level.

Options:

  • -p, --patterns <patterns>
    Path patterns to locate source video files.
  • -c, --codec [wav1 | mav1 | mx265]
    Specifies the video codec. Default is wav1.
  • -e, --encode [1 | 2 | 3]
    Defines the video encoding level. Default is 3.
  • -d, --dest <path>
    Destination folder for the compressed videos.
  • -i, --ignore <patterns>
    Path patterns to ignore during video compression.

Example Usage:

npx minomax video -p "src/videos/**/*.mp4" -c wav1 -e 2 -d "./optimized_videos"

4. minify - Minify Web Documents (JS, CSS, HTML)

This command minifies JavaScript, CSS, and HTML files.

Options:

  • -p, --patterns <patterns>
    Path patterns to locate web document files.
  • -d, --dest <path>
    Destination folder for the minified files.
  • -s, --searchBase <path>
    Base directory for file search. Default is the current working directory.
  • -i, --ignore <patterns>
    Path patterns to ignore during file processing.

Example Usage:

npx minomax minify -p "src/**/*.html" -d "./dist" -i "node_modules"

5. genset - Generate Image Sets

Generates optimized image sets for small to large devices and include them in html, automatically.

Options:

  • -p, --patterns <patterns>
    Path patterns to locate the HTML files.
  • -d, --dest <path>
    Destination folder for the image sets.
  • -i, --ignore <patterns>
    Path patterns to ignore.

Example Usage:

npx minomax genset -p "src/**/*.html" -d "./responsive"

6. init - Initialize Configuration Template

Initializes a new configuration template for Minomax.

Example Usage:

npx minomax init

Additional Notes:

  • Default Paths:
    Most commands use the destPath from the Minomax configuration by default for output destinations unless overridden with the -d option.
  • Configuration Initialization:
    Running minomax init will create the necessary configuration files for the project, allowing users to customize their optimization parameters.




Keywords:
  • Minomax CLI
  • Web optimization commands
  • Image compression
  • Video compression
  • Web document minification
  • Image set generation
  • Responsiveness