An open API service indexing awesome lists of open source software.

https://github.com/coderaiser/minify

Minifier of js, css, html and img
https://github.com/coderaiser/minify

css hacktoberfest html javascript minify uglify

Last synced: 7 months ago
JSON representation

Minifier of js, css, html and img

Awesome Lists containing this project

README

          

# Minify [![License][LicenseIMGURL]][LicenseURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![NPM version][NPMIMGURL]][NPMURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]

[NPMIMGURL]: https://img.shields.io/npm/v/minify.svg?style=flat
[BuildStatusURL]: https://github.com/coderaiser/minify/actions
[BuildStatusIMGURL]: https://github.com/coderaiser/minify/workflows/CI/badge.svg
[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat
[NPM_INFO_IMG]: https://nodei.co/npm/minify.png?stars
[NPMURL]: http://npmjs.org/package/minify
[LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License"
[CoverageURL]: https://coveralls.io/github/coderaiser/minify?branch=master
[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/minify/badge.svg?branch=master&service=github

[Minify](http://coderaiser.github.io/minify "Minify") - a minifier of `js`, `css`, `html` and `img` files.

To get things done **Minify** uses this amazing tools:

- ✅ [@putout/minify](https://github.com/putoutjs/minify);
- ✅ [html-minifier](https://github.com/kangax/html-minifier);
- ✅ [clean-css](https://github.com/jakubpawlowicz/clean-css);
- ✅ [lightningcss](https://lightningcss.dev/);
- ✅ [css-base64-images](https://github.com/Filirom1/css-base64-images);

## Install

For Node users:

```sh
npm i minify -g
```

For Deno users:

```js
import {minify} from 'npm:minify';
```

## How to use?

### CLI

```sh
Usage: minify [options]
Options:
-h, --help display this help and exit
-v, --version display version and exit
--js minify javascript
--css minify css
--html minify html
--auto auto detect format
```

The bash command below creates a code snippet saved as `hello.js`.

Simply copy + paste the code starting with cat, including the EOT on the last line, and press .

```sh
$ cat << EOT > hello.js
const hello = 'world';

for (let i = 0; i < hello.length; i++) {
console.log(hello[i]);
}
EOT
```

Use the command `minify` followed by the path to and name of the js file intended to be minified. This will minify the code and output it to the screen.

```sh
$ minify hello.js
var a='world';for(let i=0;i hello.min.js
```

You can pass input using `cat`:

```sh
cat << EOT | bin/minify.js --js
> const hello = 'world';
>
> for (let i = 0; i < hello.length; i++) {
> console.log(hello[i]);
> }
> EOT
var a='world';for(let i=0;i