Skip to content

reisraff/phulp-minifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

phulp-minifier

The minifier addon for PHULP

Install

$ composer require reisraff/phulp-minifier

Usage

<?php

use Phulp\Minifier\CssMinifier;
use Phulp\Minifier\JsMinifier;

$phulp->task('css', function ($phulp) {
    $phulp->src(['src/'], '/css$/')
        // minify
        ->pipe(new CssMinifier)
        // write minified files
        ->pipe($phulp->dest('dist/'));
});

$phulp->task('js', function ($phulp) {
    $phulp->src(['src/'], '/js$/')
        // minify
        ->pipe(new JsMinifier)
        // write minified files
        ->pipe($phulp->dest('dist/'));
});

Options

Set in the constructor.

Join : When join flag is true all distFiles will be merged in one.

joinName : Name of the joined file.

<?php

use Phulp\Minifier\CssMinifier;
use Phulp\Minifier\JsMinifier;

$cssMinifier = new CssMinifier([
    // default: false
    'join' => true,
    // default: styles.min.css
    'joinName' => 'myMinifiedCss.css'
]);
$jsMinifier = new JsMinifier([
    // default: false
    'join' => true
    // default: script.min.js
    'joinName' => 'myMinifiedJs.js'
]);