weevers / pulp
A streaming build system like gulp
Requires
- php: >=5.4.0
- mikey179/vfsstream: ~1.5
- react/event-loop: dev-master
- react/stream: 0.4.*
- webmozart/glob: dev-master
- weevers/path: ~0.2
Requires (Dev)
- phpunit/phpunit: 4.5.*
This package is not auto-updated.
Last update: 2020-08-08 17:28:26 UTC
README
pulp is a streaming build system, something like gulp for PHP. Meaning: with src("*.css")
you get a asynchronous duplex stream that emits virtual file objects. This stream can then be piped to one or more plugins or to a filesystem destination with dest("target-dir")
. pulp is a weekend experiment, please use a VM if you want to play with it. Requires PHP 5.4+.
example
This example bundles all the javascript files in "assets" and its subdirectories, then writes it to "build/all.js".
<?php use Weevers\Pulp\Pulp , Weevers\Pulp\Plugin; $pulp = new Pulp(); $pulp ->src('assets/**/*.js') ->pipe(new Plugin\Concat('all.js')) ->pipe($pulp->dest('build')) ->each(function($file){ echo "bundled all js in {$file->path}\n"; }) ; // Nothing happens until we start an event loop $pulp->run(); ?>
If we leave out the Concat plugin, all javascript files are copied. Note that a file like "assets/js/app.js" would be copied to "build/js/app.js".
<?php $pulp ->src('assets/**/*.js') ->pipe($pulp->dest('build')); $pulp->run(); ?>
install
With composer do:
composer require weevers/pulp