PHP code example of reisraff / phulp-minifier

1. Go to this page and download the library: Download reisraff/phulp-minifier library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

reisraff / phulp-minifier example snippets




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/'));
});




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'
]);