gulp-strip-code icon indicating copy to clipboard operation
gulp-strip-code copied to clipboard

Allow providing an array of several values for start_comment and end_comment

Open JacobDB opened this issue 8 years ago • 1 comments
trafficstars

It'd be nice to be able to do something like this:

var stripCode = require('gulp-strip-code');
 
gulp.task('templates', function(){
  gulp.src(['file.txt'])
    .pipe(stripCode({
      start_comment: ["<!--start-test-block-->", "/*start-test-block*/", "//start-test-block"],
      end_comment: ["<!--end-test-block-->", "/*end-test-block*/", "//end-test-block"]
    }))
    .pipe(gulp.dest('build/file.txt'));
});

In order to parse multiple types of files in one go.

JacobDB avatar Jun 08 '17 18:06 JacobDB

Alternatively, providing a regular expression for these values could work too. Along the lines of:

var stripCode = require('gulp-strip-code');
 
gulp.task('templates', function(){
  gulp.src(['file.txt'])
    .pipe(stripCode({
      start_comment: "/(?:<!--|\/\*|\/\/)start-test-block(?:-->|\*\/)?/g",
      end_comment: "/(?:<!--|\/\*|\/\/)end-test-block(?:-->|\*\/)?/g"
    }))
    .pipe(gulp.dest('build/file.txt'));
});

JacobDB avatar Jun 08 '17 18:06 JacobDB