加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angular-cli 添加pug,scss,bootstrap

发布时间:2020-12-17 09:25:53 所属栏目:安全 来源:网络整理
导读:首先确保你没有下载过angular-cli,如果下载了请确保是稳定版的,不然就清除 npm uninstall @angular-cli -gnpm cache clean 接下来安装angular-cli cnpm i @angular/cli@latest -g 接下来使用 ng --version 如果是1.0.0 说明安装成功,如果有beta,不合适当

首先确保你没有下载过angular-cli,如果下载了请确保是稳定版的,不然就清除

npm uninstall @angular-cli -g
npm cache clean

接下来安装angular-cli

cnpm i @angular/cli@latest -g

接下来使用

ng --version

如果是1.0.0 说明安装成功,如果有beta,不合适当前文档

新建项目

配置scss

ng new projectName --style=scss

添加pug

1,在node_modules文件下查找 @angular/cli/models/webpack-configs/common.js
2,然后修改common.js
3,添加pug的配置
4在rules添加

{ test: /.pug$/,loader: 'apply-loader!pug-loader?self'}

安装bootstrap

npm i bootstrap --save-dev

在.angular-cli.json文件中修改app属性

"styles": [
        "../node_modules/bootstrap/dist/css/bootstrap.css"
      ],"scripts": [
        "../node_modules/bootstrap/dist/css/bootstrap.css"
      ],

添加完成之后就可以重启启动项目了

ng server

在本地打开 localhost:4200就可以了,剩下就是快乐的敲angular2代码就好

个人实践可以运行,有问题评论就好,会定期查看...

借鉴 http://www.jianshu.com/p/f8d1742b49c1
推荐大漠老师的博客: https://my.oschina.net/mumu/blog

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读