v0.0.1 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2021 License: MIT


Compactor - Frontend compression without pain

Compactor is a simple alternative to generate a fully compressed HTML projects, including all JS, CSS and image files in the project. It was designed to work with static websites where you don't have, don't need or don't want to use NodeJS and their crap system.

The ideia is very simple: you give the root folder of the project, and compactor builds the compressed version of the project for you with all possible optimizations. Start with no configuration needed.


  • Written in Go Language in a single binary.
  • Provided as package module.
  • Optimizes HTML, CSS, SCSS, SASS, JavaScript, TypeScript, JSON and XML.
  • Compiles SCSS/SASS to CSS.
  • Compiles TypeScript to Javascript.
  • Compress Images in GIF, JPG, JPEG, PNG, SVG and WEBP format.
  • Automatically create WEBP copy from JPG, JPEG and PNG.
  • Watch mode for automation and live development.
  • Just works!

RoadMap (In Development)

  • File mapping and builder feature
  • Include or exclude files and directories
  • HTML include feature for code splitting
  • A way of create SourceMaps for HTML
  • Avif copy format from others images formats
  • Less and CoffeeScript compilers
  • Font compression
  • Advanced CLI options
  • More!

CLI - Installation and Usage

For now, we first need to install dependencies:

apt-get install -y jpegoptim optipng libjpeg-progs gifsicle webp

npm install -g html-minifier
npm install -g sass
npm install -g typescript
npm install -g uglifyjs
npm install -g svgo

Then download the most recent binary file and make it executable:

sudo wget -O /usr/local/bin/compactor && sudo chmod +x /usr/local/bin/compactor

Done! To check command flags use:

compactor --help

To compress a project, run:

compactor \
    --source /path/to/source/ \
    --destination /path/to/destination/

To watch live changes while developing a project, add the watch flag:

compactor \
    --source /path/to/source/ \
    --destination /path/to/destination/



Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL