使用 bower 安装 Bootstrap 4 [英] Installing Bootstrap 4 with bower

查看:28
本文介绍了使用 bower 安装 Bootstrap 4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经生成了一个 yeoman 网站,并且附带了 bootstrap 3,我该如何安装 bootstrap 4.

I have generated a yeoman website and that comes along with bootstrap 3, how can I install bootstrap 4 instead.

教程都说只运行bower install bootstrap",但这只是再次安装bootstrap 3.

The tutorials all say to just run "bower install bootstrap", but that just installs bootstrap 3 again.

推荐答案

首先从你的项目中删除旧的引导程序(删除 bower_components/bootstrap/ 目录)

First of all remove old bootstrap from your project (remove bower_components/bootstrap/ directory)

你有两个选择:

1.具有特定版本的 Bower 命令:

bower install bootstrap#4.0

2.使用 bower.json 文件

在您的项目根目录中创建名为 bower.json 的文件(参见下面的示例)

create file called bower.json in your project root (see example below)

{
    "name": "app-name",
    "version": "0.0.1",
    "dependencies": {
        "bootstrap": "4.0"
    }
}

然后运行

bower install

我建议使用 bower.json 文件的第二个选项,因为这是更灵活的解决方案,您可以将 boser.json 用于您需要的其他包,只需添加新行即可.

I'd recommend second option with bower.json file, because this is more flexible solution, you can use boser.json for other packages you need, by simple adding new line.

这篇关于使用 bower 安装 Bootstrap 4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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