Skip to content

cresvin/cssly

Repository files navigation

cssly

Simple & lightweight CSS minifier

Installation

npm install --save-dev cssly
# or
pnpm add -D cssly
# or
yarn add -D cssly

Getting started

1. Add a script to package.json

{
  "scripts": {
    "minify-css": "cssly"
  }
}

2. Create a .csslyrc.toml file

Create a .csslyrc.toml file in the root of your project to configure how cssly processes your CSS.

# Example .csslyrc.toml configuration


# List of CSS files to minify
input = ["styles/app.css", "styles/reset.css"]


# Directory where the minified files will be written
# Default: "dist"
outdir = "dist"


# Merge all input files into a single output file
# Default: false
onefile = false


# Name of the output file (only used when onefile = true)
# file = "out.css"


# Preserve CSS comments in the output
# Default: false
comments = false


# Preserve unnecessary whitespace for readability
# Default: false
whitespace = false

3. Run the minifier

pnpm run minify-css
Example output:
ℹ cssly v1.0.0
ℹ Minifing 2 CSS files
ℹ dist/app.css 0 kB
ℹ dist/reset.css 0 kB
✔ Minified in 14 ms

License

This project is licensed under the MIT License

About

Simple & lightweight CSS minifier

Resources

License

Stars

Watchers

Forks