I want to be able to include blocks in index.html. For example: @@ include ('_ include / page_head.html') And so that the file with the blocks remains in the development folder and is tracked in the watch watch. And here are my tasks

gulp.task('fileinclude', function() { gulp.src('src/_include/*.html') .pipe(fileinclude({ prefix: '@@', basepath: '@file' })) .pipe(concat('page.html')) .pipe(gulp.dest('src/')); //выгружаем файл }); gulp.task('watch',['browser-sync', 'fileinclude', 'less', 'scripts'], function() {// gulp.watch('src/less/**/*.less', ['less']); gulp.watch('src/*.html', browserSync.reload); gulp.watch('src/js/**/*.js', browserSync.reload); }); 

1 answer 1

Use for your project PugJS . It not only allows you to do include , but also allows you not to write closing tags, use variables. And he also has extends - inheritance, where a descendant can override ancestor blocks.

A simple example of Pug markup architecture:

 doctype html //- Global variables block vars //- Template html(lang="ru") include ../partials/head body //- Content include ../partials/header main(role='main') block content include ../partials/footer //- Scripts script(async type='text/javascript' src='js/script.js')