Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combine multiple html templates into single index.html file

Tags:

html

gulp

I've been passed down a project built through Visual Studio and it contains an index.html.bundle file. In Visual Studio these files are usually built by running the build tool and this automatically creates the index.html page by combining all the template files inside the .bundle file.

However I am running this project on a Mac and can not get access to this tool.

I want to combine all the html templates into a singular index.html template, and was wondering if there is there a tool that can automate this (i.e. gulp, etc.)?

like image 366
Simon Avatar asked Oct 29 '25 10:10

Simon


2 Answers

I found a gulp tool called gulp-concat that lets me automate this process as well. After installing, I put this into my gulpfile.js as a new task.

gulp.task('html', function() {
return gulp.src([
    'index1.html',
    'index2.html', 
    'index3.html'
])
.pipe(concat('index.html'))
.pipe(gulp.dest('./'));
});
like image 54
Simon Avatar answered Oct 31 '25 00:10

Simon


I'm sure Gulp has a tool that will do this, but if you're just trying to combine files then cat will work fine:

cat index1.html index2.html index3.html > index.html
like image 35
Chris Herbert Avatar answered Oct 31 '25 01:10

Chris Herbert



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!