What you can do instead is writing the tag yourself: a(href!='') Link You cannot do the following as Pug won’t compile the perch:content here: // doesn't workĪ(href='perch:content(id="url" type="text")/') Link In Perch templates we often have Perch tags inside HTML tags. 3- Tags inside another tag’s attributes: Perch:content(id="title" type="text" label="Title")/ Perch:content(id="title" type="text" label="Title") While Pug automatically self-close HTML tags such as img and meta, you need to explicitly self-close your Perch tags when needed: // not self-closing In Pug you can output plain text (including raw HTML) like so: perch:before In this case, we have to manually write the opening and closing tags. It’s common to have an opening tag inside and the closing tag inside. This compiles to: Notes: 1- Manually outputting opening and closing tags: perch:before Here’s how you’d write a simple perch:content tag with Pug: perch:content(id="title" type="text" label="Title")/ So I decided to try using Pug (previously known as Jade), because why not?! I was using a HTML preprocessor on a non-Perch project and I started wondering whether using one to write Perch templates would be a worthy addition to my Perch workflow.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |