{"id":1865,"date":"2013-05-22T06:34:03","date_gmt":"2013-05-22T05:34:03","guid":{"rendered":"http:\/\/thekua.com\/atwork\/?p=1865"},"modified":"2013-05-22T06:38:54","modified_gmt":"2013-05-22T05:38:54","slug":"making-jade-and-mustache-templating-work-together","status":"publish","type":"post","link":"https:\/\/thekua.com\/atwork\/2013\/05\/making-jade-and-mustache-templating-work-together\/","title":{"rendered":"Making jade and mustache templating work together"},"content":{"rendered":"<p>One our frustrations using <a href=\"http:\/\/jade-lang.com\/\" title=\"Jade\">jade<\/a> and <a href=\"http:\/\/icanhazjs.com\/\" title=\"icanhaz\">icanhaz<\/a> (a javascript front end mustache implementation) was that when we were trying things that were obvious to us, jade would simply fail to template and we weren&#8217;t sure what was causing it. <\/p>\n<p>Fortunately small TDD cycles and experimentation made us realise that it was the combination of new line characters and mustache code made jade work\/break. <\/p>\n<p>We would try something like this:<\/p>\n<pre class=\"brush: jscript; highlight: [4]; title: ; notranslate\" title=\"\">script(type=&quot;text\/html&quot;, id=&quot;my_checkbox&quot;, class=&quot;partial&quot;)\r\n  li \r\n    label(for=&quot;{{code}}&quot;)\r\n      {{name}} \r\n    input(id=&quot;{{code}}&quot;, checked=&quot;checked&quot;, name=&quot;{{code}}&quot;, type=&quot;checkbox&quot;)<\/pre>\n<p>The set of statements above would be valid mustache (once converted to HTML) but jade complains because the {{name}} is on its own line. The fix was to use the pipe (|) character to force jade to recognise a line break. It looks like this now<\/p>\n<pre class=\"brush: jscript; highlight: [4]; title: ; notranslate\" title=\"\">script(type=&quot;text\/html&quot;, id=&quot;my_checkbox&quot;, class=&quot;partial&quot;)\r\n  li \r\n    label(for=&quot;{{code}}&quot;)\r\n      | {{name}} \r\n      input(id=&quot;{{code}}&quot;, checked=&quot;checked&quot;, name=&quot;{{code}}&quot;, type=&quot;checkbox&quot;)<\/pre>\n<p>Simple, but not particularly obvious from the examples in their documentation.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One our frustrations using jade and icanhaz (a javascript front end mustache implementation) was that when we were trying things that were obvious to us, jade would simply fail to template and we weren&#8217;t sure what was causing it. Fortunately small TDD cycles and experimentation made us realise that it was the combination of new [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,47],"tags":[],"class_list":["post-1865","post","type-post","status-publish","format-standard","hentry","category-development","category-javascript","post-preview"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Making jade and mustache templating work together - patkua@work<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/thekua.com\/atwork\/2013\/05\/making-jade-and-mustache-templating-work-together\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Making jade and mustache templating work together - patkua@work\" \/>\n<meta property=\"og:description\" content=\"One our frustrations using jade and icanhaz (a javascript front end mustache implementation) was that when we were trying things that were obvious to us, jade would simply fail to template and we weren&#8217;t sure what was causing it. Fortunately small TDD cycles and experimentation made us realise that it was the combination of new [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/thekua.com\/atwork\/2013\/05\/making-jade-and-mustache-templating-work-together\/\" \/>\n<meta property=\"og:site_name\" content=\"patkua@work\" \/>\n<meta property=\"article:published_time\" content=\"2013-05-22T05:34:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-05-22T05:38:54+00:00\" \/>\n<meta name=\"author\" content=\"Patrick\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@patkua\" \/>\n<meta name=\"twitter:site\" content=\"@patkua\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Patrick\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2013\\\/05\\\/making-jade-and-mustache-templating-work-together\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2013\\\/05\\\/making-jade-and-mustache-templating-work-together\\\/\"},\"author\":{\"name\":\"Patrick\",\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/#\\\/schema\\\/person\\\/c942203c9ed3ff9e21c6c49a996ea3ae\"},\"headline\":\"Making jade and mustache templating work together\",\"datePublished\":\"2013-05-22T05:34:03+00:00\",\"dateModified\":\"2013-05-22T05:38:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2013\\\/05\\\/making-jade-and-mustache-templating-work-together\\\/\"},\"wordCount\":222,\"commentCount\":3,\"articleSection\":[\"Development\",\"Javascript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/thekua.com\\\/atwork\\\/2013\\\/05\\\/making-jade-and-mustache-templating-work-together\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2013\\\/05\\\/making-jade-and-mustache-templating-work-together\\\/\",\"url\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2013\\\/05\\\/making-jade-and-mustache-templating-work-together\\\/\",\"name\":\"Making jade and mustache templating work together - patkua@work\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/#website\"},\"datePublished\":\"2013-05-22T05:34:03+00:00\",\"dateModified\":\"2013-05-22T05:38:54+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/#\\\/schema\\\/person\\\/c942203c9ed3ff9e21c6c49a996ea3ae\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2013\\\/05\\\/making-jade-and-mustache-templating-work-together\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/thekua.com\\\/atwork\\\/2013\\\/05\\\/making-jade-and-mustache-templating-work-together\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2013\\\/05\\\/making-jade-and-mustache-templating-work-together\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Making jade and mustache templating work together\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/#website\",\"url\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/\",\"name\":\"patkua@work\",\"description\":\"The intersection of technology and leadership\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/#\\\/schema\\\/person\\\/c942203c9ed3ff9e21c6c49a996ea3ae\",\"name\":\"Patrick\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2ef85a5f91c2aac13efb3ac90077b4db7f8883cafd6e60f2bcecba6b092d4011?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2ef85a5f91c2aac13efb3ac90077b4db7f8883cafd6e60f2bcecba6b092d4011?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2ef85a5f91c2aac13efb3ac90077b4db7f8883cafd6e60f2bcecba6b092d4011?s=96&d=mm&r=g\",\"caption\":\"Patrick\"},\"sameAs\":[\"http:\\\/\\\/thekua.com\\\/atwork\"],\"url\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/author\\\/patrick\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Making jade and mustache templating work together - patkua@work","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/thekua.com\/atwork\/2013\/05\/making-jade-and-mustache-templating-work-together\/","og_locale":"en_US","og_type":"article","og_title":"Making jade and mustache templating work together - patkua@work","og_description":"One our frustrations using jade and icanhaz (a javascript front end mustache implementation) was that when we were trying things that were obvious to us, jade would simply fail to template and we weren&#8217;t sure what was causing it. Fortunately small TDD cycles and experimentation made us realise that it was the combination of new [&hellip;]","og_url":"https:\/\/thekua.com\/atwork\/2013\/05\/making-jade-and-mustache-templating-work-together\/","og_site_name":"patkua@work","article_published_time":"2013-05-22T05:34:03+00:00","article_modified_time":"2013-05-22T05:38:54+00:00","author":"Patrick","twitter_card":"summary_large_image","twitter_creator":"@patkua","twitter_site":"@patkua","twitter_misc":{"Written by":"Patrick","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/thekua.com\/atwork\/2013\/05\/making-jade-and-mustache-templating-work-together\/#article","isPartOf":{"@id":"https:\/\/thekua.com\/atwork\/2013\/05\/making-jade-and-mustache-templating-work-together\/"},"author":{"name":"Patrick","@id":"https:\/\/thekua.com\/atwork\/#\/schema\/person\/c942203c9ed3ff9e21c6c49a996ea3ae"},"headline":"Making jade and mustache templating work together","datePublished":"2013-05-22T05:34:03+00:00","dateModified":"2013-05-22T05:38:54+00:00","mainEntityOfPage":{"@id":"https:\/\/thekua.com\/atwork\/2013\/05\/making-jade-and-mustache-templating-work-together\/"},"wordCount":222,"commentCount":3,"articleSection":["Development","Javascript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/thekua.com\/atwork\/2013\/05\/making-jade-and-mustache-templating-work-together\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/thekua.com\/atwork\/2013\/05\/making-jade-and-mustache-templating-work-together\/","url":"https:\/\/thekua.com\/atwork\/2013\/05\/making-jade-and-mustache-templating-work-together\/","name":"Making jade and mustache templating work together - patkua@work","isPartOf":{"@id":"https:\/\/thekua.com\/atwork\/#website"},"datePublished":"2013-05-22T05:34:03+00:00","dateModified":"2013-05-22T05:38:54+00:00","author":{"@id":"https:\/\/thekua.com\/atwork\/#\/schema\/person\/c942203c9ed3ff9e21c6c49a996ea3ae"},"breadcrumb":{"@id":"https:\/\/thekua.com\/atwork\/2013\/05\/making-jade-and-mustache-templating-work-together\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/thekua.com\/atwork\/2013\/05\/making-jade-and-mustache-templating-work-together\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/thekua.com\/atwork\/2013\/05\/making-jade-and-mustache-templating-work-together\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/thekua.com\/atwork\/"},{"@type":"ListItem","position":2,"name":"Making jade and mustache templating work together"}]},{"@type":"WebSite","@id":"https:\/\/thekua.com\/atwork\/#website","url":"https:\/\/thekua.com\/atwork\/","name":"patkua@work","description":"The intersection of technology and leadership","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/thekua.com\/atwork\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/thekua.com\/atwork\/#\/schema\/person\/c942203c9ed3ff9e21c6c49a996ea3ae","name":"Patrick","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/2ef85a5f91c2aac13efb3ac90077b4db7f8883cafd6e60f2bcecba6b092d4011?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/2ef85a5f91c2aac13efb3ac90077b4db7f8883cafd6e60f2bcecba6b092d4011?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2ef85a5f91c2aac13efb3ac90077b4db7f8883cafd6e60f2bcecba6b092d4011?s=96&d=mm&r=g","caption":"Patrick"},"sameAs":["http:\/\/thekua.com\/atwork"],"url":"https:\/\/thekua.com\/atwork\/author\/patrick\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/posts\/1865","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/comments?post=1865"}],"version-history":[{"count":4,"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/posts\/1865\/revisions"}],"predecessor-version":[{"id":1867,"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/posts\/1865\/revisions\/1867"}],"wp:attachment":[{"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/media?parent=1865"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/categories?post=1865"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/tags?post=1865"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}