【发布时间】:2018-02-07 13:14:05
【问题描述】:
我有一个 angular-cli 应用程序并使用 webpack。 当我尝试运行它时,组件特定的 css 不起作用
styles.css
/* You can add global styles to this file, and also import other style files*/
@import 'http://something/v4/dist/css/bootstrap.min.css';
组件
@Component({
selector: 'app-carousel',
templateUrl: './carousel.component.html',
styleUrls: ['./carousel.component.css']
})
export class CarouselComponent implements OnInit {
组件 CSS
.carousel-indicators { display: none; }
angular-cli.config
"styles": [
"styles.css",
"../node_modules/roboto-fontface/css/roboto/sass/roboto-fontface-bold.scss",
"../node_modules/roboto-fontface/css/roboto/sass/roboto-fontface-light.scss",
"../node_modules/roboto-fontface/css/roboto/sass/roboto-fontface-regular.scss"
],
呈现的 html
<style type="text/css">@import url(http://something/v4/dist/css/bootstrap.min.css);</style>
<style type="text/css">/* You can add global styles to this file, and also import other style files */
</style><style></style><style>.carousel-indicators[_ngcontent-c5] { display: none; }</style>
但这不适用于我的 html 元素“carousel-indicators”
如果我将carousel.component.css导入styles.css,那么它可以工作,但它在生成的html中出现两次
我正在寻找正确的方法
【问题讨论】:
-
可能是因为我正在混合使用 scss 和 css?
-
我在这里找到了我的问题的答案:stackoverflow.com/questions/45788972/…
标签: css angular webpack angular-cli