A
A
AlexeyFrost2019-03-31 17:55:14
Layout
AlexeyFrost, 2019-03-31 17:55:14

How to create variables in html using gulp?

Guys, can you tell me if it is possible to create variables in html files using gulp?
That is: let's say I'm building a multi-page site and I want the corresponding menu link to be active when I'm on a certain page.
In php, it would look like this:
<a href="" class="<? if (activePage = "about") { ?> active <? } ?>">About the company</a>
And on the corresponding page, I would set variable value: <? $activePage = "about" ?>
And as a result, the "About" link would be active.
That is, you need the ability to create and check variables, I don’t know how else to explain it))
Is it possible to do the same with php using gulp, but in files with html extension? Maybe there is a plugin? Thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Viktor Yanyshev, 2019-03-31
@villiwalla

For start = is an assignment, with <? there is no conclusion. You need js and location

A
Artem Kondratsky, 2019-04-01
@kondrackii

you can use template engines like ejs

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question