Skip to content

Instantly share code, notes, and snippets.

@sms-system
Last active June 30, 2016 11:04
Show Gist options
  • Save sms-system/abbd5595c174ef2ecdfb25486979e397 to your computer and use it in GitHub Desktop.
Save sms-system/abbd5595c174ef2ecdfb25486979e397 to your computer and use it in GitHub Desktop.
Magic wraping for pug.js (JADE)
mixin wraper()
- var prevBuf = pug_html
- pug_html = ''
- block()
- wrapResult = pug_html
- pug_html = prevBuf
mixin wrap()
- var prevBuf = pug_html
- pug_html = ''
- block()
- var contentResult = pug_html
- pug_html = prevBuf
!= wrapResult.replace(/<content><\/content>/g, contentResult)
+wraper
+if("{% link }")
a(href="{% link }"): content
+else
div: content
+wrap
.bar {% title }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment