2017 © Pedro Peláez
 

library minify

A package for minifying styles and javascript for laravel 5

image

devfactory/minify

A package for minifying styles and javascript for laravel 5

  • Wednesday, December 21, 2016
  • by devfactory
  • Repository
  • 10 Watchers
  • 75 Stars
  • 83,291 Installations
  • PHP
  • 11 Dependents
  • 0 Suggesters
  • 70 Forks
  • 9 Open issues
  • 11 Versions
  • 8 % Grown

The README.md

Minify

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

With this package you can minify your existing stylesheet and JavaScript files for Laravel 10. This process can be a little tough, this package simplifies and automates this process., (*2)

For Laravel 5 - 9 please use version 1.x of this package., (*3)

For Laravel 4 please use ceesvanegmond/minify, (*4)

Installation

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

{
    "require": {
        "devfactory/minify": "^2.0"
    }
}

After the package installation, the MinifyServiceProvider and Minify facade are automatically registered. You can use the Minify facade anywhere in your application., (*6)

To publish the config file:, (*7)

php artisan vendor:publish --provider="Devfactory\Minify\MinifyServiceProvider" --tag="config"

Upgrade to v2

Minify version 2 is PHP 8.1+ and Laravel 10+ only., (*8)

Required upgrade changes

If the Devfactory\Minify\Contracts\MinifyInterface interface is implemented, make sure update your implementation according to the updated types and exceptions., (*9)

If the Devfactory\Minify\Providers\BaseProvider abstract class is used, make sure update your classes according to the updated types and exceptions., (*10)

The method Devfactory\Minify\Providers\StyleSheet#urlCorrection has been renamed to Devfactory\Minify\Providers\StyleSheet#getFileContentWithCorrectedUrls., (*11)

Rename the minify.config.php configuration file to minify.php., (*12)

Usage

Stylesheet

// app/views/hello.blade.php

<html>
    <head>
        ...
        {!! Minify::stylesheet('/css/main.css') !!}
        // or by passing multiple files
        {!! Minify::stylesheet(['/css/main.css', '/css/bootstrap.css']) !!}
        // add custom attributes
        {!! Minify::stylesheet(['/css/main.css', '/css/bootstrap.css'], ['foo' => 'bar']) !!}
        // add full uri of the resource
        {!! Minify::stylesheet(['/css/main.css', '/css/bootstrap.css'])->withFullUrl() !!}
        {!! Minify::stylesheet(['//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/', ['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(['/js/jquery.js', '/js/jquery-ui.js']) !!}
    // add custom attributes
    {!! Minify::javascript(['/js/jquery.js', '/js/jquery-ui.js'], ['bar' => 'baz']) !!}
    // add full uri of the resource
    {!! Minify::javascript(['/js/jquery.js', '/js/jquery-ui.js'])->withFullUrl() !!}
    {!! Minify::javascript(['//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/', ['bar' => 'baz', 'async' => true]) !!}
    // minify and combine all javascript files in given folder with full uri
    {!! Minify::javascriptDir('/js/')->withFullUrl() !!}
</html>

The Versions

21/12 2016

dev-master

9999999-dev

A package for minifying styles and javascript for laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by Da Costa Alcindo

laravel5 minify

14/11 2016

dev-S3

dev-S3

A package for minifying styles and javascript for laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by Da Costa Alcindo

laravel5 minify

04/01 2016

1.0.x-dev

1.0.9999999.9999999-dev

A package for minifying styles and javascript for laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by Da Costa Alcindo

laravel5 minify

04/01 2016

1.0.7

1.0.7.0

A package for minifying styles and javascript for laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by Da Costa Alcindo

laravel5 minify

12/10 2015

1.0.6

1.0.6.0

A package for minifying styles and javascript for laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by Da Costa Alcindo

laravel5 minify

18/09 2015

1.0.5

1.0.5.0

A package for minifying styles and javascript for laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by Da Costa Alcindo

laravel5 minify

18/09 2015

1.0.4

1.0.4.0

A package for minifying styles and javascript for laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by Da Costa Alcindo

laravel5 minify

18/08 2015

1.0.3

1.0.3.0

A package for minifying styles and javascript for laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by Da Costa Alcindo

laravel5 minify

17/08 2015

1.0.2

1.0.2.0

A package for minifying styles and javascript for laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by Da Costa Alcindo

laravel5 minify

09/02 2015

1.0.1

1.0.1.0

A package for minifying styles and javascript for laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by Da Costa Alcindo

laravel5 minify

05/02 2015

1.0.0

1.0.0.0

A package for minifying styles and javascript for laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by Da Costa Alcindo

laravel5 minify