gulp-html-replace
gulp-html-replace copied to clipboard
newline under comment block inserted with keepBlockTags: true
In Jetbrains IDE WebStorm, replacing content and keeping the blocks seems to add a newline under the blocks when the content is changed.
gulp.task('prodBaseUrl', function(){
gulp.src('index.html')
.pipe(htmlReplace(
{
base:{
src: 'https://myprodurl.com/index.html',
tpl: '<base href="%s" />'
}
},
{
keepBlockTags: true
})
)
.pipe(gulp.dest('./'));
});
after a couple of transformations, my index.html goes from this
<!-- build:base -->
<base href="https://myprodurl.com/index.html" />
<!-- endbuild -->
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Open+Sans' type='text/css'>
to this
<!-- build:base -->
<base href="https://myprodurl.com/index.html" />
<!-- endbuild -->
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Open+Sans' type='text/css'>