Skip to content

Instantly share code, notes, and snippets.

@hhsnopek
Last active October 8, 2016 22:40
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hhsnopek/1b12aa8500d525572535d11b653a4745 to your computer and use it in GitHub Desktop.
Save hhsnopek/1b12aa8500d525572535d11b653a4745 to your computer and use it in GitHub Desktop.
Cheatsheet for Reshape

Reshape Cheatsheet

Includes

// html
<include src='_partial.html'></include>

// sugarml
include(src="_partial.html")

// jade
include '_partial'

Layouts

Extend

// html
<extends src="base.html">

// sugarml
extends(src="base.html")

// jade
extends 'base'

Prepend

// html
<block name="title" type="prepend">foo</block>

// sugarml
block(name="title" type="prepend") foo

// jade 
N/A

Append

// html
<block name="footer" type="append"> foo</block>

//sugarml
block(name="footer" type="append") foo

// jade 
N/A

blocks

// html
<block name="content">foo</block>

// sugarml
block(name="content") foo

// jade
block 'content'

Expressions

Locals / Variables / Interpolation

// html
<p>Hello {{ world }}</p> // <p>hello earth</p>
<p>{{{ doge }}}</p> // <p><strong>doge</strong></p>

// sugarml
p hello {{ world }}
p {{{ doge }}}

// jade
p hello #{world}
p !{doge}

Conditionals

// html
<if conditional="true"><p>foo</p></if>
<elseif conditional="false"><p>bar</p></elseif>
<else><p>foobar</p></else>

// sugarml
if(conditional="true")
  p foo
elseif(conditional="false")
  p bar
else
  p foobar
  
// jade
if true
  p foo
else if false
  p bar
else
  p foobar

Loops

NOTE: In loops you cannot wrap your variables in delimiters

// html
<each loop="item, key in object">

// sugarml
each(loop="item, key in object ")

// jade
each val, index in object

Links:

Plugin Directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment