webpack打包angular2 css冲突

使用webpack打包angular2的css会发生冲突

angular2将样式用字符串的形式写在styles不会影响其他的样式,但是通过CSS文件引入的方式就会影响其他的样式。我试过将CSS 转化为字符串,样式不会互相影响特,但CSS 里面的图片webpack 不打包了

home中的class会覆盖live中的同名class
但是将样式写在home的styles中却不会冲突

home/
    home.component.ts
    index.html
    home.css
--------------------------------------------
 home.component.ts
@Component({
  selector: 'home',
  styleUrls: [
    './home.css',
  ],
  templateUrl: 'home.component.html',
})
-live/
    live.component.ts
    index.html
    live.css
--------------------------------
live.component.ts
@Component({
  selector: 'live',
  styleUrls: [
    './live.css',
  ],
  templateUrl: './index.html',

})
阅读 2.9k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题