atyagi / laravel4-minify

A Laravel 4 package for minifying your .css and .js. It caches the file with an uniq fingerprint. When you adjust your CSS/JS, your old cached/minified files are deleted, and a new cachefile is placed.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Laravel4 Minify Package

A Laravel 4 package for minifying your .css and .js. It caches the file with an uniq fingerprint. When you adjust your CSS/JS, your old cached/minified files are deleted, and a new cachefile is placed.

Installation

Instal it via composer

Add the following line in your composer.json

  "ceesvanegmond/minify": "dev-master"

Please add the following line in your config/app.php under 'providers'.

  'CeesVanEgmond\Minify\MinifyServiceProvider',

Run command

  composer update

Config

You can publish the config file via this command.
php artisan config:publish ceesvanegmond/minify

Info about the different configurations

'ignore_min' => Environments to not minify
'css_path' => The CSS path (from your public) defaults to '/css/'
'css_build_path' => The build path where the minified + concatenate build files are (relative from above aption) defaults to 'builds/'
'js_path' => The JS path (from your public) defaults to '/js/'
'js_build_path' => The build path where the minified + concatenate build files are (relative from above aption) defaults to 'builds/'

That's it, you can now start using the package

Usage

There are two helpers available to use, the 'stylesheet' helper, and the 'javascript' helper Example to minify your JavaScript (in .blade file)
{{ javascript(array(
  	'jquery-1.9.1.min.js',
		'hashchange.js',
		'tracer.js',
		'includes.js',
		'lightbox.js',
		'history.js',
		'transforms.js',
		'main.js',
		'ga.js'
	)) 
}}

Or CSS

{{ stylesheet('main.css') }}

You'll notice that you can set multiple files as an array, or just one file (string) The system will only react if you're' not on the 'local' environment!!!

About

A Laravel 4 package for minifying your .css and .js. It caches the file with an uniq fingerprint. When you adjust your CSS/JS, your old cached/minified files are deleted, and a new cachefile is placed.


Languages

Language:PHP 100.0%