Minifine
, (*1)
Installation
Simply include this library into your projects using composer:, (*2)
"require": {
"peehaa/minifine": "^2"
},
Requirements
PHP 7+, (*3)
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:, (*4)
<?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:, (*5)
<head>
<meta charset="UTF-8">
<title>Page title</title>
<link rel="stylesheet" href="/css/min.css">
</head>
And:, (*6)
<?= $minifier->js(['/js/jquery-1.11.2.min.js', '/js/bootstrap.min.js', '/js/custom.js'], '/js/min.js'); ?>
</body>
</html>
results in:, (*7)
<script src="/js/min.js"></script>
</body>
</html>
For more advanced usages like using different minifiers and/or chaining minifiers please consult the documentation., (*8)
Documentation
The documentation (including the contribution guidelines) can be found on the project's website., (*9)
License
MIT, (*10)