Escape String in pug
Hello. I was wondering how i can escape string in pug? I have a pre tag and a code tag. And i want to be able to write css code inside the code tag. But if i write for example
.box
inside the code tag it tries to create a div with class .box
so i need some way that it will not create a new class but read it as normal text15 Replies
No one here can help?
Not at my PC atm but start a new line and use |
| words
I tried that but it did not work... :/ Maybe it is just my compiler idk. But i can write php code just fine in the pug file using the | escape character
Make a minimal codepen
I'll text when I get to a PC
Okay i will do that
Hmm.... Yeah okay, so it works on codepen but not with my compiler in vscode... Okay intersting. So the | escape character does work. I am just using a terribly bad pug compiler i guess ^^
Anyway, i guess you can close the post then since the code is working. It's just a problem with the compiler
Good you got it working
What compiler/build tools you using?
https://marketplace.visualstudio.com/items?itemName=jaheenafsarsyed.live-pug-compiler
I use this one
Live Pug Compiler - Visual Studio Marketplace
Extension for Visual Studio Code - Compile Pug to HTML at realtime with live browser reload.
Yes I would get away from extensions, use an actual build tool
Parcel or Vite
Vite still lacks a good MPA solutions for template languages but
You could just make a nice watch script too, like Kevin does for scss
Yeah. Thats what i would prefer. Because i am using the same package.json as kevin use to compiler scss to css. So it would be awesome to have the same thing for pug compiler... But i am not sure if it already exists, and i don't know how to make it :p
I'll get back to you, this is on my to-do list. Just haven't been using pug much for full sites now that I'm addicted to Sveltekit
Aah alright. Thank you very much 🙂
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Oh thank you very much ! I will definitely try this 🙂
Btw is there any way to output php files instead of html files?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Ooh hmm okay. Thanks