I
I
IIIu6ko2020-06-04 09:20:42
HTML
IIIu6ko, 2020-06-04 09:20:42

Can PUG be used with regular HTML syntax?

Good morning. I found out right now that PUG understands regular HTML syntax and the question is: "Can I use PUG with regular HTML syntax?"

In general, I like PUG, many people know it, so there are fewer problems with support if the project gets to someone else, but I don’t like the indented syntax, but all sorts of conditions, includes, loops, etc. they are good enough.

Actually the main question: Is it possible to mix the syntax? All html should be written in the usual syntax, but the constructions of conditions, cycles in the PUG syntax?

Example:

- var user = { description: 'foo bar baz' }
- var authorised = false
<div id="user">
  if user.description
    <h2 class="green">Description</h2>
    <p class="description">#{user.description}</p>
  else if authorised
    <h2 class="blue">Description</h2>
    <p class="description">User has no description, why not add one...</p>
  else
    <h2 class="red">Description</h2>
    <p class="description">User has no description</p>
</div>


How would you react to this if such a project came across? Does it make sense? Maybe it's easier to use TWIG right away? In general, your opinion is of interest.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lord_Dantes, 2020-06-04
@Lord_Dantes

Well, if so, then I would use react, and not crutches that mimic it ..

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question