juntyfile.php
<?php require 'vendor/autoload.php'; use Junty\Runner\JuntyRunner; use Gabrieljmj\JuntyMinify\{Css as CssMinifier, Js as JsMinifier}; $junty = new JuntyRunner(); $junty->group('minify', function () { $this->task('css', function () { $this->src('./public/css/*.css') ->forStreams(new CssMinifier()) ->forStreams($this->toDir('public/dist/css')); }); $this->task('js', function () { $this->src('./public/js/*.js') ->forStreams(new JsMinifier()) ->forStreams($this->toDir('public/dist/js')); }); }); $junty->task('zip', function () { $this->src('./*') ->forStreams(function (array $streams) { $zip = new ZipArchive(); if ($zip->open('dest.zip', ZipArchive::CREATE)) { foreach ($streams as $stream) { $zip->addFromString( $stream->getMetaData('uri'), $stream->getContents() ); } $zip->close(); } }); }); return $junty;
junty-execution-example
$ vendor/bin/junty run
Executing tasks
Executing group 'minify'
--Executing task 'css'
--Executing task 'js'
Executing task 'zip'
Finished! Time: 200ms