在Meteor中排除特定路由的引导 [英] Excluding bootstrap from specific routes in Meteor

查看:114
本文介绍了在Meteor中排除特定路由的引导的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望任何人都能给出一些输入,

I was hoping anyone could give some input on this,

我创建一个流星应用程序,其中我想使用bootstrap来创建管理环境,但是面对面的访问者使用自定义css。当我使用meteor将启动包添加到我的应用程序时,它在每个页面都可用,是否有一种方法来限制引导加载到'/ admin'中的路由?

I'm creating a meteor app in which I would like to use bootstrap to creating the admin environment, but have the visitor facing side using custom css. When I add the bootstrap package to my app using meteor it's available on every page, is there a way to restrict the loading of bootstrap to routes that are in '/admin' ?

推荐答案

当你添加bootstrap包是不可能的。然而,您可以将引导csses添加到 public 目录,然后将它们加载到标题子模板中,只有当您在仪表板中时才会呈现。

When you add bootstrap package it's not possible. You can, however, add bootstrap csses to public directory and then load them in a header subtemplate that will only be rendered when you're in the dashboard.

 

编辑


但是如何创建单独的头模板? >

But then how would you go about creating seperate head templates?

轻松:

<head>
    ...
    {{> adminHeader}}
    ...
</head>


<template name="adminHeader">
    {{#if adminPage}}
        ... // Put links to bootstrap here
    {{/if}}
</template>



Template.adminHeader.adminPage = function() {
    return Session.get('adminPage');
}


Meteor.router.add({
    '/admin': function() {
        Session.set('adminPage', true);
        ...
    }
});

这篇关于在Meteor中排除特定路由的引导的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆