L
L
LUHANANA2020-12-08 12:06:34
HTML
LUHANANA, 2020-12-08 12:06:34

How to connect html to html?

I recently switched from sublime to VSCode and still don't understand how I can connect the header.html file to the main index.html file here. In sublime, kit helped out very well, but for some reason it doesn’t work here. Suggest a solution to the problem.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vovash, 2020-12-08
@V0vash

The logical solution would be to use a assembler (for example gulp )

  • which will make it possible to build scss/sass/less
  • "connect html to html", for example with gulp-rigger
  • collect js
  • other pleasures

for this you have to write a task for gulp
gulp.task('html', function () {
    gulp.src('src/*.html') //Выберем файлы по нужному пути
        .pipe(rigger()) //Прогоним через rigger
        .pipe(gulp.dest('dist/')) //Выплюнем их в папку build
        .pipe(browserSync.reload({stream: true})); //И перезагрузим наш сервер для обновлений
});

and => your buildable html will look like this
<!DOCTYPE html>
<html>
<head lang="ru">
    <meta charset="UTF-8">
    <title>Пум-пум</title>
</head>
<body>
    //= template/header.html

    <section class="content">
        Content
    </section>
    
    //= template/footer.html
</body>
</html>

it is worth noting that when using browsersync , the page will be updated when styles and html templats change

X
xmoonlight, 2020-12-08
@xmoonlight

Depending on the purpose for which you are making the page ... You can
simply "glue" on js with this (it works without an editor).

E
Evtihij, 2020-12-09
@Evtihij

Maybe so?:

  • How TO - Include HTML ;
  • The simplest ways to handle HTML inclusions in HTML ;
  • Include another HTML file in a HTML file .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question