Skip to content

Instantly share code, notes, and snippets.

@timkg
Created May 16, 2013 11:13
Show Gist options
  • Save timkg/5591004 to your computer and use it in GitHub Desktop.
Save timkg/5591004 to your computer and use it in GitHub Desktop.
Jade javascript and variables
// 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