Created
May 16, 2013 11:13
-
-
Save timkg/5591004 to your computer and use it in GitHub Desktop.
Jade javascript and variables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// rendering the content of a variable | |
li.tweet | |
img(src= tweet.profile_image_url) | |
h5= tweet.from_user_name | |
p= tweet.text | |
// executing some JS and conditionally render one line or the other | |
- var tweets = link._tweets.length || null; | |
ul.meta | |
li.meta-li | |
a.meta-link.tweets.text-hide | |
- if (tweets) | |
i.meta-icon.icon-twitter | |
- else | |
i.meta-icon.inactive.icon-twitter | |
// variables are escaped before rendering. If we have a string of html that we want rendered as-is, use the following syntax | |
- var html = '<span>hi</span>'; | |
p !{html} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment