go-minifier

command module
v0.0.0-...-2e73374 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2025 License: MIT Imports: 6 Imported by: 0

README ΒΆ

Go Minifier

A lightweight command-line tool designed to simplify and streamline the minification process for CSS and JavaScript files. Minification involves the removal of unnecessary characters and spaces from code, resulting in smaller file sizes that contribute to improved web page loading times.

πŸš€ Quick Start

Get up and running in under 2 minutes:

# Install the tool
go install github.com/Alitindrawan24/go-minifier

# Minify a CSS file
go-minifier -src styles.css

# Minify a JavaScript file  
go-minifier -src script.js -opt js

πŸ“‹ Requirements

  • Go 1.19 or later

πŸ”§ Installation & Setup

Option 1: Direct Installation
go install github.com/Alitindrawan24/go-minifier
Option 2: Local Development

Using HTTPS:

git clone https://github.com/Alitindrawan24/go-minifier.git
cd go-minifier

Using SSH:

git clone git@github.com:Alitindrawan24/go-minifier.git
cd go-minifier

πŸ“– Usage

Minify CSS Files

Basic usage - Creates filename.min.css:

go run . -src styles.css

Custom output filename:

go run . -src styles.css -out production.min.css

Working with multiple CSS files:

# Minify multiple CSS files
go run . -src main.css
go run . -src components.css -out components.min.css
go run . -src responsive.css -out responsive.min.css
Minify JavaScript Files

Basic usage - Creates filename.min.js:

go run . -src script.js -opt js

Custom output filename:

go run . -src app.js -out app.min.js -opt js

Working with multiple JavaScript files:

# Minify multiple JS files
go run . -src main.js -opt js
go run . -src utils.js -out utils.min.js -opt js
go run . -src vendor.js -out vendor.min.js -opt js
Command Line Options
Option Description Required Default
-src Path to the source file βœ… -
-out Path to the output file ❌ filename.min.css/js
-opt Minifier type (css or js) ❌ css

Valid values for -opt:

  • css - For CSS files (default)
  • js - For JavaScript files

πŸ“Š Example Output

After minification, you'll see file size statistics:

File styles.css original size: 15 KB
File styles.min.css output size: 8 KB (reduced by 46.67%)

πŸ› οΈ Development

Running Tests
make test
Code Formatting
make fmt
Linting
make lint

πŸ“ Todo

  • Minify all CSS/JS files in a directory
  • Batch processing capabilities
  • Additional file format support

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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