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 text
15 Replies
Tok124 (CSS Nerd)
Tok124 (CSS Nerd)OP•3y ago
No one here can help?
b1mind
b1mind•3y ago
Not at my PC atm but start a new line and use | | words
Tok124 (CSS Nerd)
Tok124 (CSS Nerd)OP•3y ago
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
b1mind
b1mind•3y ago
Make a minimal codepen I'll text when I get to a PC
Tok124 (CSS Nerd)
Tok124 (CSS Nerd)OP•3y ago
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
b1mind
b1mind•3y ago
Good you got it working What compiler/build tools you using?
Tok124 (CSS Nerd)
Tok124 (CSS Nerd)OP•3y ago
Live Pug Compiler - Visual Studio Marketplace
Extension for Visual Studio Code - Compile Pug to HTML at realtime with live browser reload.
b1mind
b1mind•3y ago
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
Tok124 (CSS Nerd)
Tok124 (CSS Nerd)OP•3y ago
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
b1mind
b1mind•3y ago
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
Tok124 (CSS Nerd)
Tok124 (CSS Nerd)OP•3y ago
Aah alright. Thank you very much 🙂
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Tok124 (CSS Nerd)
Tok124 (CSS Nerd)OP•3y ago
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
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Tok124 (CSS Nerd)
Tok124 (CSS Nerd)OP•3y ago
Ooh hmm okay. Thanks
Want results from more Discord servers?
Add your server