Huddler
A streaming build system designed for Symfony PHP projects.
Place a huddler taskfile.js
in the root of your project and let it gather the assets from each bundle and place them in the web directory. Like any other streaming system, individual assets can be piped around, compiled and/or combined. Almost all gulp
plugins can be used with Huddler
.
This module is intended to be used by twifty/huddler-bundle
which provides some useful commands and twig
templating features.
Sample taskfile
var Huddler = require('huddler'),
concat = require('gulp-concat');
Huddler.task('scripts', () => {
return Huddler.huddle()
.pipe(Huddler.webDir());
});
Huddler.task('styles', () => {
return Huddler.huddle()
.pipe(concat('main.css'))
.pipe(Huddler.webDir());
});
function fonts() {
return Huddler.huddle().pipe(Huddler.webDir());
}
function images() {
return Huddler.huddle().pipe(Huddler.webDir());
}
Huddler.task('install', Huddler.parallel('scripts', 'styles', fonts, images));
Individual Symfony bundles can export their own taskfile.js
allowing them to handle their own assets, and if one isn't exported, their assets will be gathered from their Resources/public
directory.
Assets are written or symlinked into the web directory under a subdirectory matching the task name. This avoids having to use the Symfony assets:install
command which creates a bundles
directory in the web folder. When multiple assets with the same name are detected, they are auto renamed. All written asset paths are also written to a tracker.json
file allowing for easy integration into PHP code.
NOTE
This is my first node.js
project. Any and all help is very much appreciated.
TODOs:
- tests
- use existing modules where possible
- make sure all configured paths are relative to the file within which they are defined.