Lesson 8 - JavaScript in Pug: Variables

preview_player
Показать описание
PUG TUTORIAL - LESSON 8

00:00 Intro
00:33 JavaScript variables in Pug
00:51 Setting variables
01:21 Displaying variable values
01:33 Interpolation
02:35 HTML tag equals
03:43 JavaScript concatenation
04:05 Object literals
04:51 Wrap-up

Рекомендации по теме
Комментарии
Автор

I knew a little about Pug but now I just learned a lot more. Thank you.

VincentLabStudio
Автор

I have a question, what if I want to store my vars on a js file? for example I want to store all javascript variables needed for my pug files in a single file "variables.js", and then include this file in some way that makes all these variables available for the html compilation. I guess if I include this file will be displayed as a plain text, so I think I should added as a "script(src='myfile.js')" but this will make these vars available on the final html too (what I don't want, I want these vars only available for pug), is there any other way? Or is a mandatory that I store my vars on a pug file?

paulraven
visit shbcf.ru