PHPackages                             a2design-inc/minify - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. a2design-inc/minify

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

a2design-inc/minify
===================

A package for minifying styles and javascript

2.1.3(8y ago)021MITPHPPHP &gt;=5.3.2

Since Jun 30Pushed 8y ago4 watchersCompare

[ Source](https://github.com/a2design-inc/minify)[ Packagist](https://packagist.org/packages/a2design-inc/minify)[ RSS](/packages/a2design-inc-minify/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (19)Used By (0)

Minify
======

[](#minify)

For laravel 5 please use [devfactory/minify](https://github.com/DevFactoryCH/minify)

[![Build Status](https://camo.githubusercontent.com/5391b5cda0c1742ce254ae6d2cc54e4e36faf199b60cee3f3f6d26355f52d219/68747470733a2f2f7472617669732d63692e6f72672f6365657376616e65676d6f6e642f6d696e6966792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ceesvanegmond/minify)[![Latest Stable Version](https://camo.githubusercontent.com/7c5997f1788bd88901d73507e6769e8337eb97f7e0303e08d69dcf4ee55fe154/68747470733a2f2f706f7365722e707567782e6f72672f6365657376616e65676d6f6e642f6d696e6966792f762f737461626c652e706e67)](https://packagist.org/packages/ceesvanegmond/minify)[![Total Downloads](https://camo.githubusercontent.com/d555f35bf64b3a599524e92ce0587e4903262ddfed15e8c59fc5a5e42eea0704/68747470733a2f2f706f7365722e707567782e6f72672f6365657376616e65676d6f6e642f6d696e6966792f646f776e6c6f6164732e706e67)](https://packagist.org/packages/ceesvanegmond/minify)[![License](https://camo.githubusercontent.com/d75d498c183d5e648f91219464b5112be9d76743ef1d5be1e5ac94e86d29cc0a/68747470733a2f2f706f7365722e707567782e6f72672f6365657376616e65676d6f6e642f6d696e6966792f6c6963656e73652e706e67)](https://packagist.org/packages/ceesvanegmond/minify)

With this package you can minify your existing stylessheet and javascript files. This process can be a little tough, this package simplies this process and automates it.

Installation
------------

[](#installation)

Begin by installing this package through Composer.

```
{
    "require": {
    	"ceesvanegmond/minify": "2.0.*"
	}
}
```

### Laravel installation

[](#laravel-installation)

```
// app/config/app.php

'providers' => [
    '...',
    'CeesVanEgmond\Minify\MinifyServiceProvider',
];
```

Publish the config file:

```
php artisan config:publish ceesvanegmond/minify

```

When you've added the `MinifyServiceProvider` an extra `Minify` facade is available. You can use this Facade anywhere in your application

#### Stylesheet

[](#stylesheet)

```
// app/views/hello.blade.php

		...
		{{ Minify::stylesheet('/css/main.css') }}
		// or by passing multiple files
		{{ Minify::stylesheet(array('/css/main.css', '/css/bootstrap.css')) }}
		// add custom attributes
		{{ Minify::stylesheet(array('/css/main.css', '/css/bootstrap.css'), array('foo' => 'bar')) }}
		// add full uri of the resource
		{{ Minify::stylesheet(array('/css/main.css', '/css/bootstrap.css'))->withFullUrl() }}

		// minify and combine all stylesheet files in given folder
		{{ Minify::stylesheetDir('/css/') }}
		// add custom attributes to minify and combine all stylesheet files in given folder
		{{ Minify::stylesheetDir('/css/', array('foo' => 'bar', 'defer' => true)) }}
		// minify and combine all stylesheet files in given folder with full uri
		{{ Minify::stylesheetDir('/css/')->withFullUrl() }}

	...

```

#### Javascript

[](#javascript)

```
// app/views/hello.blade.php

	...

	{{ Minify::javascript('/js/jquery.js') }}
	// or by passing multiple files
	{{ Minify::javascript(array('/js/jquery.js', '/js/jquery-ui.js')) }}
	// add custom attributes
	{{ Minify::javascript(array('/js/jquery.js', '/js/jquery-ui.js'), array('bar' => 'baz')) }}
	// add full uri of the resource
	{{ Minify::javascript(array('/js/jquery.js', '/js/jquery-ui.js'))->withFullUrl() }}

	// minify and combine all javascript files in given folder
	{{ Minify::javascriptDir('/js/') }}
	// add custom attributes to minify and combine all javascript files in given folder
	{{ Minify::javascriptDir('/js/', array('bar' => 'baz', 'async' => true)) }}
	// minify and combine all javascript files in given folder with full uri
	{{ Minify::javascriptDir('/js/')->withFullUrl() }}

```

### Config

[](#config)

```
