gulp-remove-duplicate-lines

1.0.0 • Public • Published

gulp-remove-duplicate-lines

Gulp plugin that removes all duplicate lines in a file.

Installation

npm install --save-dev gulp-remove-duplicate-lines

Usage

const removeDuplicateLines = require( 'gulp-remove-duplicate-lines' );

gulp.task( 'do-something', function() {
	return gulp.src( './src/file.txt )
		.pipe( removeDuplicateLines() )
		.pipe( gulp.dest( 'dist/' ) )
} )

Example Input File:

one
two
three
three
four
five
two
six
six
six

Output:

one
two
three
four
five
six

Optional Arguments

.pipe( removeDuplicateLines( {
    // Regex, lines that match this will not be filtered 
    // and will always be included in the output.
    exclude: /^[A-Z]/g, 

    // Regex, lines that match this will only be parsed, 
    // if the line doesn't match this, it will always be 
    // included in the output.
    include: /^\w/g,
} ) )

Package Sidebar

Install

npm i gulp-remove-duplicate-lines

Weekly Downloads

143

Version

1.0.0

License

MIT

Unpacked Size

2.67 kB

Total Files

3

Last publish

Collaborators

  • bfintal