【发布时间】:2020-08-05 09:29:24
【问题描述】:
所以我找到了一个我想使用的非常好的模板,但它只是使用引导程序的 HTML。我找到了一些关于如何转换类似项目的教程,看起来很简单(比如here)
我添加了第一个组件,头部显示如下(我注释掉了大多数,但当时只有一个链接标签可以使用):
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Some Html Template</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="" />
<meta name="keywords" content="" />
<link rel="stylesheet" type="text/css" href="../../assets/css/animate.css">
<!-- <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/line-awesome.css">
<link rel="stylesheet" type="text/css" href="css/line-awesome-font-awesome.min.css">
<link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="css/jquery.mCustomScrollbar.min.css">
<link rel="stylesheet" type="text/css" href="lib/slick/slick.css">
<link rel="stylesheet" type="text/css" href="lib/slick/slick-theme.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" type="text/css" href="css/responsive.css"> -->
</head>
我在 angular.json 中添加了以下内容:
"styles": [
"src/styles.css",
"src/assets/css/animate.css"
],
"scripts": [
"node_modules/bootstrap/dist/css/bootstrap.min.css"
]
我在styles.css中添加了:
@import "../node_modules/bootstrap/dist/css/bootstrap.min.css";
我也安装了
npm i bootstrap ngx-bootstrap jquery tether
当我尝试运行 npm start 时,出现以下错误:
ERROR in HostResourceLoader: loader(/Users/felipe/Documents/mtalents/frontend/src/assets/css/animate.css) returned a Promise
当我在没有链接标签的情况下运行它时,它运行得很好,但是所有样式都丢失了(就像我只得到一个文本块一样)。
我还没有修改脚本标签,但他们似乎还没有抱怨。
为了清楚起见,我从 src/assets 中的引导模板添加了 css、字体、图像、js、libs、供应商文件夹。
我不确定我错过了什么?提前致谢!
【问题讨论】:
-
这也不是那么重要,但我很好奇是否有人知道:我尝试在链接标签
href="assets/css/animate.css"中将其用于href,我认为将其添加到angular.json 样式中标签将使其随处可用。也许这是个问题?
标签: css angular bootstrap-4