MChan
MChan

Reputation: 7202

Meteor app multiple themes support

I am trying to build a Meteor app which should support two totally different themes (members - admin), each theme include its own separate css, LESS, JS and html files. So I was wondering does Meteor support multiple client themes and dynamic switching between themes? Thanks

Upvotes: 1

Views: 364

Answers (1)

johnnytop
johnnytop

Reputation: 93

You should be able to use Controllers using the iron:router package to achieve what you are looking for.

meteor add iron:router

Create your layouts:

<template name="AdminLayout">
    <div>
        {{> yield}}
    </div>
</template>

<template name="MemberLayout">
    <div>
        {{> yield}}
    </div>
</template>

Then define your controllers:

AdminController = RouteController.extend({
    layoutTemplate: 'AdminLayout'
});

MemberController = RouteController.extend({
    layoutTemplate: 'MemberLayout'
});

And then you can define your routes and specify the controller they use:

Router.route('/admin', {
    controller: 'AdminController'
});

Router.route('/', {
    controller: 'MemberController'
});

Then just create separate templates using the different css, js, and whatnot.

You can read more about the package here: Iron Router

Upvotes: 1

Related Questions