# grunt-contrib-compressor

> compress files and mixed file.

Latest version **0.1.3** (published 2013-12-15) · 0 weekly downloads

## Install

```sh
npm install grunt-contrib-compressor
pnpm add grunt-contrib-compressor
yarn add grunt-contrib-compressor
bun add grunt-contrib-compressor
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2013-12-15 |
| First published | 2013-12-15 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.8.0 |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+4 in 3 direct dependencies) |
| Install scripts | no |
| Author | donghanji |
| Maintainers | donghanji |
| Keywords | gruntplugin |

## Links

- npm: https://www.npmjs.com/package/grunt-contrib-compressor
- Repository: https://github.com/donghanji/compressor
- Issues: https://github.com/donghanji/compressor/issues
- npm.io page: https://npm.io/package/grunt-contrib-compressor

## Dependencies (4)

- [clean-css](https://npm.io/package/clean-css.md) ~1.0.4
- [uglify-js](https://npm.io/package/uglify-js.md) ~2.3.5
- [html-minifier](https://npm.io/package/html-minifier.md) ~0.5.0
- [grunt-lib-contrib](https://npm.io/package/grunt-lib-contrib.md) ~0.6.1

## Recent versions

- 0.1.3 (latest) — 2013-12-15
- 0.1.2 — 2013-12-15
- 0.1.1 — 2013-12-15

## README

##### Compress file, including CSS, JS and HTML
##### Can also to compress a mixed files, which is including HTML, CSS and JS,like this,
	<html>
		<head>
			<title>Test</title>
			<style type="text/css" rel="stylesheet"><!--css-->
				html,body{margin:0;padding:0;width:100%;height:100%;}
				.red{color:red;}
				.green{color:green;}
			</style>
		</head>
			<body>
				<div>1</div>
				<div>2</div>
				<script type="text/javascript"><!--js-->
					(function(){
						//
						var text='1\n';
						
						console.log(text);
					})();
				</script>
				<script type="text/javascript"><!--js-->
					(function(){
						//
						var mytest='2\n';
						
						console.log(mytest);
					})();
				</script>
				<div>3</div>
				<script id="t2" type="text/x-template" data-vid="T"><!--html template-->
					<div>4</div>
					<div>5</div>
				</script>
			</body>
			<script type="text/javascript" src="/module.js"></script>
	</html>

	compressor:{
		css:{
			//compress css file, like cssmin, to https://github.com/gruntjs/grunt-contrib-cssmin
		},
		js:{
			//compress js file, like uglify, to https://github.com/gruntjs/grunt-contrib-uglify
		},
		html:{
			//compress html file, like htmlmin, to https://github.com/gruntjs/grunt-contrib-htmlmin
		}
	}


##### Sample
	compressor:{
		css:{
			options:{
				banner: '/* My minified css file */'
			},
			files: {
				'tmp/style.css': ['test/fixtures/input_one.css', 'test/fixtures/input_two.css']
			}
		},
		js:{
			options: {
				mangle: true
			},
			files:grunt.file.expandMapping(['test/*.js','test/*/*.js','test/*/*/*.js'], '', {
				rename: function(base,file) {
					
					return 'tmp/js'+'/'+file;
				}
			})
		},
		html:{
			options:{
				removeComments: true,
				collapseWhitespace: true
			},
			files:{
				'tmp/test1.html': ['test/test1.html']
			}
		}
	}

---
_Source: https://npm.io/package/grunt-contrib-compressor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
