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

twitter-bootstrap – 导入引导少于扩展类在字形字体上创建404

发布时间:2020-12-18 00:26:56 所属栏目:安全 来源:网络整理
导读:在我的Angular 2应用程序中,我从raw css切换到较少,以便我可以写: .main-button { .btn; .btn-primary; padding: 1em;} 而不是在我的HTML中堆叠类名.为了让这个工作,我需要: 在angular-cli.json中,更改: “defaults”:{ “styleExt”:“css”, “prefix
在我的Angular 2应用程序中,我从raw css切换到较少,以便我可以写:
.main-button {
  .btn;
  .btn-primary;
  padding: 1em;
}

而不是在我的HTML中堆叠类名.为了让这个工作,我需要:

>在angular-cli.json中,更改:

“defaults”:{
“styleExt”:“css”,
“prefixInterfaces”:false
}

到“styleExt”:“少”,
>将我的foo.component.css重命名为foo.component.less并相应地更新foo.component.ts.
>在组件少的时候,为了引用引导类,我不得不:@import“?bootstrap / less / bootstrap”;

这样做很好,除了我现在在浏览器控制台中收到404错误:

jquery-1.12.3.min.js:2 GET http://localhost:4200/node_modules/bootstrap/fonts/bootstrap/glyphicons-halflings-regular.woff2 (anonymous function) @ jquery-1.12.3.min.js:2i @ jquery-1.12.3.min.js:2fireWith @ jquery-1.12.3.min.js:2ready @ jquery-1.12.3.min.js:2K @ jquery-1.12.3.min.js:2
foobar:1 GET http://localhost:4200/node_modules/bootstrap/fonts/bootstrap/glyphicons-halflings-regular.woff 
foobar:1 GET http://localhost:4200/node_modules/bootstrap/fonts/bootstrap/glyphicons-halflings-regular.ttf

我在@ icon-font-path上尝试了一些变体,但没有成功.我检查了网络选项卡中的字体请求,并查看http:// localhost:4200 / 448c34a56d699c29117adc64c43affeb.woff2.

我也试图用sass / scss.这需要具有类似的include指令的附加模块bootstrap-sass,但结果完全相同.

什么是正确的方法来做到这一点没有404错误?

这是由ng服务提供,所有这些都是默认的.

解决方法

我有同样的问题与sass:
$icon-font-path: "~bootstrap-sass/assets/fonts/bootstrap/";
@import "~bootstrap-sass/assets/stylesheets/bootstrap";

https://github.com/igorzg/angular2-zero-to-hero/blob/master/ui/src/styles.scss

所以对于较少应该在你的风格.没有:

$icon-font-path: "~bootstrap/fonts/";
@import "~bootstrap/less/bootstrap";

(编辑:李大同)

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

    推荐文章
      热点阅读