title: How can I write a simple gulp pipe function?
body: <p>I've been trying for a day to write two pipe functions, one that compiles less files and another one that concats these files. I want to learn how to write transform streams/pipes for more complex plugins.</p>
  
  <p>So I want to know how to read data from another pipe, and how to alter that data and send it to the next pipe. This is what I have so far:</p>
  
  <pre><code> gulp.src(sources)
     .pipe(through.obj(function (chunk, enc, cb) {
  
       var t = this;
       // console.log("chunk", chunk.path);
       fs.readFile(chunk.path, enc, function (err,data) {
         if (err) { cb(err); }
  
         less.render(data, {
           filename : chunk.path,
           sourceMap : {
             sourceMapRootpath : true
           }
         })
         .then(function (outputCss) {
            // console.log("less result",outputCss);
            t.push(chunk);// or this.push(outputCss) same result
            cb();
         });
  
       });
  
     }))
     .pipe(through.obj(function (chunk, enc, cb) {
       console.log("chunk", chunk.path); // not event getting called.
       cb();
     }))
  </code></pre>
  
  <p>I can't get the <code>outputCSS</code> for each file in the second pipe. How can I send it?</p>