PHPackages                             guestisp/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. guestisp/minify

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

guestisp/minify
===============

A package for minifying styles and javascript for laravel 5

1.0.7(7y ago)013MITPHPPHP &gt;=5.4.0

Since Feb 5Pushed 7y ago1 watchersCompare

[ Source](https://github.com/guestisp/minify)[ Packagist](https://packagist.org/packages/guestisp/minify)[ RSS](/packages/guestisp-minify/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (6)Versions (9)Used By (0)

Minify
======

[](#minify)

[![Build Status](https://camo.githubusercontent.com/543f5859877ed3ddbe02fcf9a256fbf7f81de01629970f0ce0d4dee4e188f7fa/68747470733a2f2f7472617669732d63692e6f72672f446576466163746f727943482f6d696e6966792e737667)](https://travis-ci.org/DevFactoryCH/minify)[![Latest Stable Version](https://camo.githubusercontent.com/19f4c4119af55a87b4e6abee8e09b6798553652a4700f8f8cbfbe816cc202117/68747470733a2f2f706f7365722e707567782e6f72672f646576666163746f72792f6d696e6966792f762f737461626c652e737667)](https://packagist.org/packages/devfactory/minify)[![Total Downloads](https://camo.githubusercontent.com/0e7bb2208dec18035a204497670e7572eb088260c56c272cb2777f04df435e52/68747470733a2f2f706f7365722e707567782e6f72672f646576666163746f72792f6d696e6966792f646f776e6c6f6164732e737667)](https://packagist.org/packages/devfactory/minify)[![License](https://camo.githubusercontent.com/14fd9bc048ca2a6faa7c932426cf213324be9046b61787f3c34741c4e57c718e/68747470733a2f2f706f7365722e707567782e6f72672f646576666163746f72792f6d696e6966792f6c6963656e73652e737667)](https://packagist.org/packages/devfactory/minify)

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

For Larvel 4 please use [ceesvanegmond/minify](https://github.com/ceesvanegmond/minify)

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

[](#installation)

Begin by installing this package through Composer.

```
	{
	    "require": {
	    	"devfactory/minify": "1.0.*"
		}
	}
```

### Laravel installation

[](#laravel-installation)

Then register the service provider and Facade by opening `config/app.php`

```
'Devfactory\Minify\MinifyServiceProvider',

'Minify'        => 'Devfactory\Minify\Facades\MinifyFacade',

```

Publish the config file:

```
	php artisan vendor:publish

```

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::stylesheet(array('//fonts.googleapis.com/css?family=Roboto')) !!}

			// 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::javascript(array('//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js')) !!}

		// 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)

```
