在使用angular-cli创建的应用中安装bootstrap

继续之前的话题,我们要在使用angular-cli创建的应用程序中安装bootstrap。

操作步骤

由于希望在全局范围中进行引用,请按照以下参考进行操作:
https://github.com/angular/angular-cli#global-library-installation

由于无法立即安装,进行了调查。
http://stackoverflow.com/questions/39017376/angular-cli-webpack-3rd-part-css-files

提升angular-cli的版本并重新安装。

npm install angular-cli@latest

然后,通过ng new PROJECT_NAME重新构建应用程序,并安装bootstrap。

npm install bootstrap@next --save

“将”bootstrap”: “^4.0.0-alpha.5″ 添加到 package.json”

请将angular-cli.json文件按照以下方式进行修改。

Kobito.EFLn4f.png

进行修正后,执行 ng serve 并重新构建,Bootstrap 可以使用了。

这次的sample已经被推送到GitHub了。
https://github.com/kkeisuke/angular-cli-sample/commit/03cf9d100572cb5219640ae9aa2c5181c5d6f5a3

除此之外,我还注意到其他的一些问题。

    最新バージョンでは構成が変わっていました。
.
├── e2e
└── src
    ├── app
    ├── assets
    └── environments

ng new PROJECT_NAME でリポジトリも出来るので、かなり便利

Kobito.4UVEqf.png

ng コマンドを打つと、watchman のエラーがでる。

issue が出ているようですが、まだクローズされていない模様 (2016/10/26)

https://github.com/angular/angular-cli/issues/2791

Could not start watchman; falling back to NodeWatcher for file system events.