Skip to content

hhsnopek/jumblr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jumblr

Jade Tumblr Mixins

Installation

Usage

include the jumblr.jade at the top of your main jade file:

include node_modules/jumblr/lib/jumblr

Mixins

+jumblr(type) - Standard Tumblr block

+jumblr('Video')
  li(class="post video")
    {Video-500}
    +jumblr('Caption')
      div(class="caption") {Caption}

//- output
{block:Video}
<li class="post video">{Video-500}{block:Caption}
  <div class="caption">{Caption}</div>{/block:Caption}
</li>{/block:Video}

+jumblrStr(type, content) - Standard Tumblr block as string (Great for nesting tags)

+jumblrStr('IndexPage', 'optional-class ')
section(class= jumblrStr)

//- output
<section class="{block:IndexPage}optional-class {/block:IndexPage}"></section>

+jumblrStrList({type: content, type: content}) - Standard Tumblr block list as string (Great for concatenating tags)

+jumblrStr("NoSearchResults", "no-results ")
+jumblrStrList({"TagPage": "tag ", "SearchPage": "search "+jumblrStr})
+jumblrStrList({"IndexPage": "index "+jumblrStrList, "PermalinkPage": "permalink "})

body(class= jumblrStrList)

//- output
<body class="{block:IndexPage}index {block:TagPage}tag {/block:TagPage}{block:SearchPage}search {block:NoSearchResults}no-results {/block:NoSearchResults}{/block:SearchPage}{/block:IndexPage}{block:PermalinkPage}permalink {/block:PermalinkPage}"></body>

+jumblrVar(type, preWhitespace) - Standard Tumblr variable (Great for removing "missing space" error)

p
  +jumblrVar('Scallywag')
  | : Oh
  +jumblrVar('Caption', true)
    |  my Captain

//- output
<p>{Scallywag}: Oh {Caption} my Captain</p>

License

MIT