css - 从 Meteor 中的特定路由中排除 Bootstrap

标签 css twitter-bootstrap meteor

我希望任何人都可以对此提供一些意见,

我正在创建一个 meteor 应用程序,我想在其中使用 Bootstrap 来创建管理环境,但让访问者使用自定义 css。当我使用 meteor 将 Bootstrap 包添加到我的应用程序时,它在每个页面上都可用,有没有办法限制 Bootstrap 加载到“/admin”中的路由?

最佳答案

当您添加 Bootstrap 包时,这是不可能的。但是,您可以将 Bootstrap csses 添加到 public 目录,然后将它们加载到标题子模板中,该模板仅在您位于仪表板中时呈现。


编辑

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);
        ...
    }
});

关于css - 从 Meteor 中的特定路由中排除 Bootstrap ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17685957/

相关文章:

javascript - "Not allowed to load local resource" Electron/VUE

css - 我可以用 Susy 堆叠列吗?

css - Resharper 是否告诉我 css 类是未知的,因为它在 CDN 上?

css - Rails 简单表单 CSS

Meteor 抛出错误 "Exception in defer callback: Error: Can' t 调用非函数 : [object Object]"when using flowrouter

javascript - 无法在 React 和 Meteor 中使用 componentWillMount 读取未定义的属性

javascript - 如何将 Javascript 项目存储库符号链接(symbolic link)到 Meteor 应用程序中

html - 创建 .grid.column 类时的@for 指令问题

javascript - 通过 javascript 提交表单时 Bootstrap 成功警报

html - css 字体大小和行高与基线不匹配