Anon
Anon

Reputation: 145

Macros based code execution in HTML

Can we enable a part of code using something like MACROS in html language like we do in C,C++ etc ? or Is there any other mechanism available which can be helpful in this scenario?
Example in C:

#ifdef ENABLE_TESTS
// code that you want to run ONLY during tests 
#endif

Any help would be appreciated. :)

Upvotes: 0

Views: 45

Answers (1)

Quentin
Quentin

Reputation: 944008

HTML is not a programming language; it has nothing like macros.

You can generate your HTML programmatically using a template language (such as Template-Toolkit or Nunjucks) which will allow you to do this type of thing.

Upvotes: 1

Related Questions