Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Meteor with Jade, Flow Router and Blaze?

I'm trying to make Jade work with Meteor's Flow Router and Blaze. Somehow it doesn't work for me. I'm pretty sure it's just something small that I don't notice.

HTML versions of home.jade and layout.jade files give a proper, working result.

According to this, there used to be a problem, but it was solved in 0.2.9 release of mquandalle:jade.

$ meteor list

blaze                2.1.2  Meteor Reactive Templating library
kadira:blaze-layout  2.0.0  Layout Manager for Blaze (works well with FlowRou...
kadira:flow-router   2.3.0  Carefully Designed Client Side Router for Meteor
meteor-platform      1.2.2  Include a standard set of Meteor packages in your...
mquandalle:jade      0.4.3  Jade template language

layout.jade

template(name="layout")
  +Template.dynamic(template="main")

home.jade

template(name="home")
  p Looks like working!

routes.js

FlowRouter.route('/', {
  name: 'home',
  action: function() {
    BlazeLayout.render('layout', {main: 'home'});
  }
});

The result:

<body>
  <div id="__blaze-root">
  </div>
</body>
like image 864
ddarkowski Avatar asked Aug 25 '15 09:08

ddarkowski


1 Answers

Indeed, it is just a subtle detail issue: you should not use quotes around the main parameter in your layout template:

template(name="layout")
  +Template.dynamic(template=main)
like image 126
SylvainB Avatar answered Nov 15 '22 10:11

SylvainB