简体   繁体   English

Angular样板和Twitter Bootstrap 3

[英]Angular boilerplate and Twitter Bootstrap 3

I am trying to use this project https://github.com/ngbp/ngbp but with Twitter Bootstrap 3. I find no posts on how to do that. 我试图使用这个项目https://github.com/ngbp/ngbp,但使用Twitter Bootstrap 3.我找不到关于如何做到的帖子。 Is it because: 是因为:

  1. It can't be done 它无法完成
  2. It shouldn't be done 不应该这样做
  3. I am the only one in the world who wants to do that 我是世界上唯一一个想要这样做的人
  4. There are other better ways to do that. 还有其他更好的方法可以做到这一点。

I am afraid that using Twitter Bootstrap 2.3.2 as this boilerplate code comes with is old. 我担心使用Twitter Bootstrap 2.3.2,因为这个样板代码附带的是旧的。 Am I right? 我对吗?

I have tried to fix it myself but I give up the jungle world of JavaScript scripts and bugs that must be combined in a top secret order and maybe if you are lucky you don't get an error. 我试图自己修复它,但我放弃了JavaScript脚本和bug的丛林世界,必须以最高机密的顺序组合,也许如果你很幸运,你不会得到错误。 Please help me. 请帮我。

I consider using Yeoman good practice for scaffolding out new projects. 我考虑使用Yeoman的好习惯来搭建新项目。 The advantage to using Yeoman is that it creates the more arcane files used by Grunt (a build tool) and Bower (a dependency management tool). 使用Yeoman的优势在于它创建了Grunt(构建工具)和Bower(依赖管理工具)使用的更多神秘文件。 There is a generator for Angular. Angular有一个生成器 It will allow you to pick a good working set of libraries, create the project, and add more components that you find necessary later. 它将允许您选择一组良好的工作库,创建项目,并添加您稍后需要的更多组件。 Yeoman is really just Grunt+Bower and then Yo - a tool for stubbing out project skeletons. Yeoman实际上只是Grunt + Bower,然后是Yo - 一个用于截断项目骨架的工具。 The nice thing is that you can continue to add Angular components after creating your project and it will update your config files letting you play around with the structure. 不错的是,您可以在创建项目后继续添加Angular组件,它将更新您的配置文件,让您可以使用该结构。

If you would like to use Bootstrap 3, I suggest looking at Angular-Bootstrap which is part of the Angular UI group of projects. 如果您想使用Bootstrap 3,我建议您查看Angular-Bootstrap ,它是Angular UI项目组的一部分。 Angular Bootstrap contains the portion of Bootstrap that is javascript but is rewritten to use angular style directives.The CSS and icons must still be included and can be found in the normal bootstrap library. Angular Bootstrap包含Bootstrap的一部分,它是javascript但被重写为使用angular style指令。仍然必须包含CSS和图标,并且可以在普通的bootstrap库中找到它们。 The instructions for including the Bootstrap CSS and some great plunker examples are available in the Angular-UI readme. Angular-UI自述文件中提供了包含Bootstrap CSS和一些优秀插件示例的说明。

Update Here is what a bower.json might look like. 更新这是bower.json的样子。 Notice that bootstrap is included separately. 请注意,引导程序是单独包含的。 This is because the bootstrap css is a separate dependency so that angular-ui does not need to be updated whenever bootstrap is. 这是因为引导程序css是一个单独的依赖项,因此无论何时引导程序都不需要更新angular-ui。

{
    "name": "test",
    "version": "0.0.1",
    "ignore": [
        "**/.*",
        "node_modules",
        "lib",
        "test",
        "tests"
    ],
    "dependencies": {
        "angular": "latest",
        "angular-route": "latest",
        "angular-bootstrap": "latest",
        "angular-ui-utils": "latest",
        "bootstrap": "latest",
    },
    "devDependencies": {
        "angular-mocks": "latest",
        "angular-scenario": "latest"
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM