Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to use block content as a variable? #3454

Open
ghost opened this issue Dec 15, 2024 · 0 comments
Open

Is it possible to use block content as a variable? #3454

ghost opened this issue Dec 15, 2024 · 0 comments

Comments

@ghost
Copy link

ghost commented Dec 15, 2024

Hi, I extended a .pug file to my index.html file(i know this isn’t how i was supposed to use it) and when i place ‘block content’ in index.html it converts it to html when I run pug -w ./ -o ./ . I wanted to know is it possible to have the ‘block content’ text in the index.html stay ‘block content’ but render the contents on the website almost like calling a variable instead of it behaving as a replace function: replace(‘block content’, h1 hello world! /h1). I took out the syntax (<>) cause it actually rendered an h1 element when i posted this.

The reason i’m asking is i want to use generic html but implement pug in the generic html when generating dynamic lists (i.e. of products) using loops because pug is neater than Django’s Jinja for dynamic data.

index.pug file

image

index.html file after run pug -w ./ -o ./html

image

output

image

index.html file when i press control z

image

Is there a way to have my index.html look like the last graphic but still output what I put in pug because I noticed that if I pressed ctrl z in index.html then dispose live server and close the browser and rerun it I get the same output correct output.

video evidence of me exploiting some bug?:

50677148-0bfc-469b-9094-8113eac7bf5c.mov
VIDEO-2024-12-15-16-32-09.mov

apologies for the length

pug version: 2.0.4
pug-cli version: 1.0.0-alpha6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants