• Stars
    star
    198
  • Rank 190,855 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 9 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Layout Manager for Blaze (works well with Meteor FlowRouter)

BlazeLayout (kadira:blaze-layout) Build Status

This project is earlier known as meteorhacks:flow-layout. This is an exact copy of FlowLayout but in a different name.

Blaze Layout Manager for Meteor

This is a layout manager designed for Blaze. This is built to use with FlowRouter but, this can be used without FlowRouter too. This is a very simple layout manager. It will does following:

  • Allow you to render a layout template to the UI
  • Allow you to pass data to the layout
  • Only re-render when necessary parts of the layout
  • Can be used with multiple layouts

Usage

First install BlazeLayout with:

meteor add kadira:blaze-layout

Then create following few templates

<template name="layout1">
  {{> Template.dynamic template=top}}
  {{> Template.dynamic template=main}}
</template>

<template name="header">
  <h1>This is the header</h1>
</template>

<template name="postList">
  <h2>This is the postList area.</h2>
</template>

<template name="singlePost">
  <h2>This is the singlePost area.</h2>
</template>

Now you can render the layout with:

BlazeLayout.render('layout1', { top: "header", main: "postList" });

Then you will get output like below:

  <h1>This is the header</h1>
  <h2>This is the postList area.</h2>

Sometimes later, you can render the layout again:

BlazeLayout.render('layout1', { top: "header", main: "singlePost" });

Since only the main is changed, top section won't get re-rendered. Here's the HTML you'll get:

  <h1>This is the header</h1>
  <h2>This is the singlePost area.</h2>

Rendering Multiple Templates

Likewise you can create multiple templates and switch between each other. But when you are changing the layout, whole UI will get re-rendered again.

So, it's a good idea to use a few layouts if possible.

Set Different Root Node

By default, BlazeLayout render layouts into a DOM element with the id __blaze-root. Sometimes, you may need to change it or just render layouts into the body. If so, here's how to do it.

Add following code inside on the top of one of your client side JS file:

BlazeLayout.setRoot('body');

You can set any CSS selector, DOM Node, or jQuery object as the root.

More Repositories

1

lokka

Simple JavaScript Client for GraphQL
JavaScript
1,532
star
2

flow-router

Carefully Designed Client Side Router for Meteor
JavaScript
1,089
star
3

mantra

Mantra - An Application Architecture for Meteor
Shell
980
star
4

fast-render

Render you app even before the DDP connection is live. - magic?
JavaScript
559
star
5

subs-manager

Subscriptions Manager for Meteor
JavaScript
358
star
6

graphql-errors

Better error handling for GraphQL
JavaScript
253
star
7

npm-base

A base package for creating NPM packages with ES2015
JavaScript
161
star
8

meteor-debug

Full Stack Debugging Solution for Meteor
JavaScript
152
star
9

meteor-react-layout

Simple React Layout Manager for Meteor with SSR Support
JavaScript
138
star
10

meteor-dochead

Isomorphic way to manipulate document.head for Meteor apps
JavaScript
134
star
11

react-mounter

A simple way to mount React components
JavaScript
130
star
12

meteor-graphql

GraphQL Support for Meteor with Lokka
JavaScript
90
star
13

graphql-blog-schema

GraphQL Schema for a Blog App
CSS
84
star
14

graphqlify

Build GraphQL queries with JavaScript
JavaScript
56
star
15

react-simple-di

Simple Dependancy Injection Solution for React
JavaScript
56
star
16

react-stubber

Simple but useful stubbing solution React
JavaScript
50
star
17

blaze-plus

Adds Props and State Management functionality to Meteor's Blaze Template Engine.
JavaScript
50
star
18

meteor-login-state

Share Login State Between the Domain
JavaScript
45
star
19

meteor-reaktor

Easy to use React Frontend for FlowRouter
JavaScript
42
star
20

lokka-transport-http

HTTP Transport Layer for Lokka
JavaScript
41
star
21

lokka-transport-jwt-auth

Lokka GraphQL Transport with JWT Support
JavaScript
22
star
22

graphql-utils-js

A set of utilities for apps building with graphql-js
JavaScript
20
star
23

mongo-sharded-cluster

Shard MongoDB in the app layer
JavaScript
13
star
24

meteor-stripe-konnect

Stripe for Meteor Apps
JavaScript
12
star
25

mantra-tutor-lessons

11
star
26

kadiyadb

KadiraDB is a low level database for storing time series data
Go
10
star
27

node-eventloop-monitor

Simple way to monitor eventloop blockness in Node.js
JavaScript
9
star
28

nofat

Set of tools to kick start server side ES2016 development
JavaScript
6
star
29

node-base

Base app for all the server side node apps at Kadira
JavaScript
6
star
30

kadira-core

JavaScript
5
star
31

regex-query-filter

JavaScript
3
star
32

storybook-addon-hello

A simple hello-world example addon for storybook
JavaScript
3
star
33

lokka-transport-http-auth

HTTP Transport for Lokka with Basic Auth
JavaScript
2
star
34

meteor-string-highlighter

String Highlighter for Meteor Apps
JavaScript
2
star
35

url-mailer

JavaScript
2
star
36

fastcall

A fast bi-directional communication layer over tcp
Go
2
star
37

storybook-ping-receiver

Listen to anonymous usage pings sent from storybooks
JavaScript
2
star
38

kadira-debug-toy

MeteorToys integration for kadira:debug Package
JavaScript
2
star
39

go-tools

Go tools is a collection of re-usable go packages used by multiple KadiraHQ projects
Go
2
star
40

kadira.io

Kadira Blog
JavaScript
2
star
41

kadiradb-node

NodejS client for KadiraDB metrics database.
JavaScript
1
star
42

mongo-mask

Replaces data with masked values in mongo queries
JavaScript
1
star
43

kadiradb

A real time metrics database which uses KadiraDB under the hood
Go
1
star