peehaa / minifine
Minifier for web resources
2.0.0
2016-07-17 15:50 UTC
Requires
- php: ^7
- matthiasmullie/minify: ^1
Requires (Dev)
- phpunit/phpunit: ^4.3
This package is auto-updated.
Last update: 2024-11-06 10:05:55 UTC
README
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.