2017 © Pedro Peláez
 

library minify

A package for minifying styles and javascript

image

ceesvanegmond/minify

A package for minifying styles and javascript

  • Thursday, April 16, 2015
  • by ceesvanegmond
  • Repository
  • 11 Watchers
  • 196 Stars
  • 87,406 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 70 Forks
  • 5 Open issues
  • 18 Versions
  • 1 % Grown

The README.md

Minify

For laravel 5 please use devfactory/minify, (*1)

Build Status Latest Stable Version Total Downloads License, (*2)

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., (*3)

Installation

Begin by installing this package through Composer., (*4)

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

Laravel installation


// app/config/app.php 'providers' => [ '...', 'CeesVanEgmond\Minify\MinifyServiceProvider', ];

Publish the config file:, (*5)

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, (*6)

Stylesheet

// app/views/hello.blade.php

<html>
    <head>
        ...
        {{ 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() }}
    </head>
    ...
</html>

Javascript

// app/views/hello.blade.php

<html>
    <body>
    ...
    </body>
    {{ 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() }}
</html>

Config

<?php

return array(

    /*
    |--------------------------------------------------------------------------
    | App environments to not minify
    |--------------------------------------------------------------------------
    |
    | These environments will not be minified
    |
    */

    'ignore_environments' => array(
         'local',
    ),

    /*
    |--------------------------------------------------------------------------
    | CSS path and CSS build path
    |--------------------------------------------------------------------------
    |
    | Minify is an extension that can minify your css files into one build file.
    | The css_path property is the location where your CSS files are located
    | The css_builds_path property is the location where the builded files are
    | stored.  This is relative to the css_path property.
    |
    */

    'css_build_path' => '/css/builds/',

    /*
    |--------------------------------------------------------------------------
    | JS path and JS build path
    |--------------------------------------------------------------------------
    |
    | Minify is an extension that can minify your JS files into one build file.
    | The JS_path property is the location where your JS files are located
    | The JS_builds_path property is the location where the builded files are
    | stored.  This is relative to the css_path property.
    |
    */

    'js_build_path' => '/js/builds/',

);

Without Laravel

<?php
$config = array(
    'ignore_environments' => 'local',
    'js_build_path' => '/js/builds/',
    'css_builds_path' => '/css/builds',
)
$minify = new CeesVanEgmond\Minify\Providers\Javascript($public_path);
$minify->add($file)

if (in_array($environment, $config['ignore_environments']))
{
    return $provider->tags();
}

if ( ! $minify->make($config['css_build_path'] ) {
    $filename = $provider->tag($config['css_build_path'] . $provider->getFilename());
}

$provider->minify();

$filename = $provider->tag($config['css_build_path'] . $provider->getFilename());

The Versions

16/04 2015

dev-master

9999999-dev

A package for minifying styles and javascript

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel minify

08/12 2014

2.0.13

2.0.13.0

A package for minifying styles and javascript

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel minify

05/12 2014

2.0.12

2.0.12.0

A package for minifying styles and javascript

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel minify

05/12 2014

2.0.11

2.0.11.0

A package for minifying styles and javascript

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel minify

04/12 2014

2.0.10

2.0.10.0

A package for minifying styles and javascript

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel minify

04/12 2014

2.0.9

2.0.9.0

A package for minifying styles and javascript

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel minify

04/12 2014

2.0.8

2.0.8.0

A package for minifying styles and javascript

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel minify

12/06 2014

dev-develop

dev-develop

A package for minifying styles and javascript

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel minify

03/06 2014

2.0.7

2.0.7.0

A package for minifying styles and javascript

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel minify

02/06 2014

2.0.6

2.0.6.0

A package for minifying styles and javascript

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel minify

15/05 2014

2.0.5

2.0.5.0

A package for minifying styles and javascript

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel minify

25/04 2014

2.0.4

2.0.4.0

A package for minifying styles and javascript

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel minify

17/04 2014

2.0.3

2.0.3.0

A package for minifying styles and javascript

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel minify

16/04 2014

2.0.2

2.0.2.0

A package for minifying styles and javascript

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel minify

04/04 2014

2.0.1

2.0.1.0

A package for minifying styles and javascript

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel minify

04/04 2014

2.0

2.0.0.0

A package for minifying styles and javascript

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel minify

05/03 2014

1.1

1.1.0.0

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.

  Sources   Download

MIT

The Requires

 

laravel minify

01/07 2013

1.0

1.0.0.0

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.

  Sources   Download

The Requires

 

laravel minify