Package.json
{
"name": "broccoli-aglio",
"version": "0.1.0",
"description": "Broccoli filter to get output from spawned process",
"author": "Jan Misek <[email protected]> (https://github.com/janmisek)",
"license": "MIT",
"devDependencies": {
"aglio": "^1.18.0",
"broccoli": "^0.15.3",
"broccoli-filter": "^0.1.12",
"broccoli-static-compiler": "^0.2.1",
"rsvp": "^3.0.18",
"spawn-sync": "^1.0.6"
},
"dependencies": {
"fs-extra": "^0.18.0"
}
}
Brocfile.js
var rsvp = require('rsvp');
var spawn = require('spawn-sync');
var Filter = require('broccoli-filter');
var pickFiles = require('broccoli-static-compiler');
Compiler.prototype = Object.create(Filter.prototype);
Compiler.prototype.constructor = Compiler;
function Compiler (inputTree, options) {
if (!(this instanceof Compiler)) {
return new Compiler(inputTree, options);
}
this.inputTree = inputTree;
this.options = options || {};
}
Compiler.prototype.extensions = ['md'];
Compiler.prototype.targetExtension = 'html';
Compiler.prototype.processFile = function (srcDir, destDir, relativePath) {
var src = srcDir + '/' + relativePath;
var dst = destDir + '/' + this.getDestFilePath(relativePath);
var out = spawn('/usr/bin/aglio', ['-i', src, '-o', dst]);
return rsvp.resolve();
};
var files = pickFiles('./api', {
srcDir: './',
destDir: './'
});
module.exports = Compiler(files);