Created a project in the galp. Now the question was how to set up the file structure. I understand that such blocks as header and footer need to be taken out separately, so that later in the need to change one file, and it has changed on all pages. Advise articles, video tutorials, where it understands. I will be good

  • Depending on the server, this is done differently. There is an http extension allowing you to do <!--include under Apache. There is php, there is asp and aspx. In each technology, this is done differently. Clarify the question. - nick_n_a

1 answer 1

For these purposes, I use rigger:

gulpfile.js:

 var rigger = require('gulp-rigger'); // Задача html gulp.task('html', function() { gulp.src(path.watch.html) .pipe(rigger()) .pipe(gulp.dest(path.build.html)); }); 

where path.watch.html is the path to the folder with the html files, and path.build.html is the path where you build the project.

Now in index.html (for example):

 //= templates/head.html //= templates/header.html <div class="content" id="root"> //= pages/main.html </div> //= templates/footer.html 

rigger collects index.html for you by inserting code from specified files into it