Skip to content

Instantly share code, notes, and snippets.

@omniphx
Last active July 31, 2021 07:08
Show Gist options
  • Save omniphx/e6279a2b21f8c6e2e26a to your computer and use it in GitHub Desktop.
Save omniphx/e6279a2b21f8c6e2e26a to your computer and use it in GitHub Desktop.
Create a new file with gulp
var
gulp = require('gulp'),
tap = require('gulp-tap'),
path = require('path'),
newfile = require('gulp-file');
gulp.task('new-file', function(){
gulp.src('./foo.derp')
.pipe(tap(function(file){
var fileName = path.basename(file.path) + ".derp";
var contents = 'hello!';
return newfile(fileName, contents)
.pipe(gulp.dest('dist'));
}));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment