Skip to content

PeeHaa/Minifine

Repository files navigation

Minifine

Build Status Scrutinizer Code Quality Code Coverage GitHub license

Installation

Simply include this library into your projects using composer:

"require": {
    "peehaa/minifine": "^2"
},

Requirements

PHP 7+

Usage

Basic usage

Only a couple of lines are needed to use Minifine. First an instance needs to be created. After that you can start combining and minifying resources:

<?php
$minifier = (new \Minifine\Factory())->build('/path/to/resources', true);

<head>
    <meta charset="UTF-8">
    <title>Page title</title>
    <?= $minifier->css(['/css/bootstrap.min.css', '/css/jquery.ui.min.css', '/css/theme.css', '/css/custom.css'], '/css/min.css'); ?>
</head>

results in:

<head>
    <meta charset="UTF-8">
    <title>Page title</title>
    <link rel="stylesheet" href="/css/min.css">
</head>

And:

        <?= $minifier->js(['/js/jquery-1.11.2.min.js', '/js/bootstrap.min.js', '/js/custom.js'], '/js/min.js'); ?>
    </body>
</html>

results in:

        <script src="/js/min.js"></script>
    </body>
</html>

For more advanced usages like using different minifiers and/or chaining minifiers please consult the documentation.

Documentation

The documentation (including the contribution guidelines) can be found on the project's website.

License

MIT