Skip to content

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

@ghost

Description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions