gpt4 book ai didi

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

转载 作者:技术小花猫 更新时间:2023-10-29 11:35:32 25 4
gpt4 key购买 nike

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

我正在创建一个 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com