Skip to content

Instantly share code, notes, and snippets.

@ilya-dev ilya-dev/runner.php
Last active Aug 29, 2015

Embed
What would you like to do?
Laravel Task Runner - how that might look like
<?php
// in app/tasks.php
// the second argument contains the array of "dependencies"
task("default", ["minify_css", "minify_js", "concatenate"]);
// smart enough to analyze the arguments
// and "inject" required components
task("minify_css", function($minifyCss)
{
// read as:
// "scan the directory app/assets/css" and pipe all files through
// $minifyCss component, then save it to public/css
$this->in('app/assets/css')->pipe($minifyCss())->out('public/css');
});
task("minify_js", function($minifyJs)
{
// you can even pass settings!
$settings = [
'keepComments' => true,
];
$this->in('app/assets/js')->pipe($minifyJs($settings))->out('public/js');
});
task("concatenate", function($concatenator)
{
$this->in('public/js')->pipe($concatenator())->out('public/main.js');
$this->in('public/css')->pipe($concatenator())->out('public/main.css');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.