fcompose

A file composer

#fcompose

Compose one or multiple files into one or mulitple places.

$ npm install fcompose

fcompose as a pipeline

var compose = require('fcompose');
 
compose('origin.txt', 'output.txt', function(buffernext) {
  next(             
    buffer.toString().toUpperCase()
  );
});

fcompose as a packer

var compose = require('fcompose')
 
compose({
    input:  ['a.js' , 'b.js' , 'c.js']
  , output: ['path/to/abc.js', 'path/to/abc2.js']
  , processorfunction(buffernext) {
      next(minify(buffer.toString())
    },
  , donefunction(stamp) {
      console.log(stamp);
    }
}); 
 
// Quick and dirty way to strip white spaces. 
function minify(input) {
  return input
    .replace(/^\s*/g, '')
    .replace(/\n*/g, '')
    .replace(/\s*([\=\.\(\)\:\{\}\,])\s*/g, '$1') 
}

MIT