Skip to content

Instantly share code, notes, and snippets.

@mlrawlings
Last active April 15, 2017 07:18
Show Gist options
  • Save mlrawlings/48bbdd2a3d2f528c979de1f411b777a2 to your computer and use it in GitHub Desktop.
Save mlrawlings/48bbdd2a3d2f528c979de1f411b777a2 to your computer and use it in GitHub Desktop.
Pug vs Marko: Layouts
html
head
title -- My Site - ${input.title}
include(input.scripts)
if(!input.scripts)
script src='/jquery.js'
body
include(input.content)
include(input.foot)
if(!input.foot)
#footer
p -- some footer content
html
head
title My Site - #{title}
block scripts
script(src='/jquery.js')
body
block content
block foot
#footer
p some footer content
include('./layout.marko')
@scripts
script src='/jquery.js'
script src='/pets.js'
@content
h1 -- ${input.title}
$ var pets = ['cat', 'dog']
for(petName in pets)
include('./pet.marko') name=petName
extends layout.pug
block scripts
script(src='/jquery.js')
script(src='/pets.js')
block content
h1= title
- var pets = ['cat', 'dog']
each petName in pets
include pet.pug
p -- ${input.name}
p= petName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment