Skip to content

Instantly share code, notes, and snippets.

@sarvar
Created September 12, 2019 12:59
Show Gist options
  • Save sarvar/8ae17928c2c1c04937dd039ff58ed7c0 to your computer and use it in GitHub Desktop.
Save sarvar/8ae17928c2c1c04937dd039ff58ed7c0 to your computer and use it in GitHub Desktop.
The Simplest Ways to Handle HTML Includes
var fileinclude = require('gulp-file-include'),
gulp = require('gulp');
gulp.task('fileinclude', function() {
gulp.src(['index.html'])
.pipe(fileinclude({
prefix: '@@',
basepath: '@file'
}))
.pipe(gulp.dest('./'));
});
<body>
@@include('./header.html')
Content
@@include('./footer.html')
</body>
npm i gulp-file-include
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment