0.1.3 • Published 9 years ago

gulp-sync-processor v0.1.3

Weekly downloads
1
License
WTFPL
Repository
github
Last release
9 years ago

gulp sync processor

Sometime we need to use the data which other pipe emitted for processing into docs or other files by template. But if downstream depend the files, in async may it will cause error. so we may need this library.

Build Status Dependencies

Usage

var dataCache;

gulp.src()
  .pipe()
  .pipe()
  .on('data',function(data){
      dataCache = data;
  })
  .pipe()
  .pipe(syncProcessor({
    files:[
      {
        src: 'src/dest.html.template',
        dest: 'src/dest.html',
        options:{

        }
      }
    ],
    options: {
      data: dataCache,
      isProcess: function(data){
        return true;
      },  
      processor: function(tplString, data){
        return _.template(tplString, data);
      }
    }
  }))
  .pipe(gulp.dest())

files' opts will merge with global.