Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-group-aggregate

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-group-aggregate

a group and aggregate plugin for gulp (and other streams)

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
30
decreased by-57.75%
Maintainers
1
Weekly downloads
 
Created
Source

gulp-group-aggregate NPM version NPM dep Build status

a group and aggregate plugin for gulp

Usage

First, install gulp-group-aggregate as a development dependency:

npm install --save-dev gulp-group-aggregate

Then, add it to your gulpfile.js:

var path = require('path');
var groupAggregate = require('gulp-group-aggregate');

var processFiles = function (files) {...}; 

gulp.task('folderWrap', function(){
  gulp.src(...)
  	.pipe(groupAggregate({
  		group: function (file){
  			// group by the directory name of each file
  			return path.basename(path.dirname(file.path));
  		}, 
  		aggregate: function (group, files){
  			// create a new file by processing the grouped files
  			return {
  				path: group + '.html',
  				contents: new Buffer(processFiles(files))
  			};
  		}
  	}));
    .pipe(gulp.dest(...));
});

API

gulp-group-aggregate is a function(options) that returns a read-write stream. The options argument should include two functions: group and aggregate.

options.group

Type: function(File) returns string

Receives a vinyl from the stream and returns a string which represents its group.

options.aggregate

Type: function(string, File[]) returns File.options

Receives a group string as returned from group calls and an array of all the files associated with it. Returns a vinyl constructor.options object. The options will be used to construct a file which will be pushed through the stream.

Keywords

FAQs

Package last updated on 16 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc