https://github.com/babounlek/minify
Package to minify css and javascript script or file
https://github.com/babounlek/minify
laravel minify-css minify-javascript php
Last synced: 11 days ago
JSON representation
Package to minify css and javascript script or file
- Host: GitHub
- URL: https://github.com/babounlek/minify
- Owner: babounlek
- License: mit
- Created: 2017-08-29T10:15:26.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-08-29T15:58:47.000Z (over 8 years ago)
- Last Synced: 2024-07-28T04:51:57.078Z (over 1 year ago)
- Topics: laravel, minify-css, minify-javascript, php
- Language: PHP
- Size: 16.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Minify
## Intallation
For installation, add a dependency on babounlek/minify to your composer.json
```sh
composer require babounlek/minify "dev-master"
```
## Usage
In your app.php,
In providers section add:
```php
babounlek\minify\minifyServiceProvider::class,
```
Now in aliases section add:
```php
'minify' => babounlek\minify\minify::class,
```
```php
use minify;
$min = new minify($source);
$min->setExtension("css");
$result = $min->minify();
or
$min = new minify();
$min->addsource($source);
$min->setExtension("css");
$result = $min->minify();
/*$result is an array containing of tree elements as:
- first is the compressed string
- second is the size of original string
- third is the size of final string
*/
/* $source can be a css or javascript script or url of css or javascript file*/
```
### Sample
#### input
```css
.container-search {
margin-top: 55px;
margin-bottom: 10px;
}
```
#### output
```php
['.container-search{margin-top:55px;margin-bottom:10px}', 66,56]
```
## Try it
Try it online at: