Skip to content

gafreax/csscrunch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

b7c33c6 · Feb 22, 2025
Feb 14, 2025
Feb 12, 2025
Feb 22, 2025
Feb 22, 2025
Nov 28, 2024
Oct 27, 2024
Dec 7, 2024
Dec 7, 2024
Dec 7, 2024
Feb 22, 2025
Feb 22, 2025
Feb 22, 2025
Feb 14, 2025

Repository files navigation

CSS Crunch

This package provides a powerful and efficient TypeScript library for optimizing CSS strings. It enables developers to easily compress css JavaScript projects.

The great focus is on keeping a great compatibility across all kind of render engine especially on the various Outlook.

Features

  • Group rules: Group same rules with one selector.
  • Compress: Compress the size by removing not necessary char.
  • Merge selector: Merge same selector into only one.
  • Media Query: Move all media queries at the bottom.

Installation

npm install @gafreax/csscrunch

Usage

import * as csscrunch from '@gafreax/csscrunch';

const cssString = '.example { color: red; font-size: 16px; }';
const parsedCSS = csscrunch.compile(cssString);

CLI Usage

Quickly clean up your Css:

To optimize your CSS file, simply run the following command in your terminal:

$ npm start -- compile input.css -o optimized.css

Or via npx

$ npx @gafreax/csscrunch compile input.css -o optimized.css

Or via global install

$ npm install -g @gafreaxa/csscrunch
$ csscrunch compile input.css -o optimized.css

Contribution

We welcome contributions to this open-source project. If you encounter issues or have suggestions for improvement, please feel free to create GitHub issues or submit pull requests.