Replace matched strings in files for defined values
$ npm install --save-dev gulp-substituter
var substituter = require('gulp-substituter');
gulp.task('replace', function() {
return gulp.src('index.html')
.pipe(substituter({
title: 'website'
}))
.pipe(gulp.dest('dist'))
});
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title><!-- substitute:title --></title>
</head>
<body>
</body>
</html>
Object of keys that you want to replace
Type: String
Default: <!--
Start tag for matching values
Type: String
Default: -->
End tag for matching values
Type: String
Default: substitute
prefix before key
{
title: 'website',
description: 'sample website',
analytics: 'example-123'
}