fcompose

0.2.1 • Public • Published

fcompose

Compose one or multiple files into one or mulitple places.

Installation

$ npm install fcompose

Example

fcompose as a pipeline

var compose = require('fcompose');
 
compose('origin.txt', 'output.txt', function(buffer, next) {
  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']
  , processor: function(buffer, next) {
      next(minify(buffer.toString())
    },
  , done: function(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') 
}

License

MIT

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.2.10latest

Version History

VersionDownloads (Last 7 Days)Published
0.2.10
0.2.00
0.1.00

Package Sidebar

Install

npm i fcompose

Weekly Downloads

0

Version

0.2.1

License

none

Last publish

Collaborators

  • yuanchuan