Global CSS for an app with web components

2019-07-14 01:32发布

问题:

I'm developing a web application that uses HTML 5 native web components. My problem is that I have a lot of common CSS for all of these and I use font awesome to have nice icons. Right now I put all my styles inside "/deep" shadow piercing but Chrome says : "/deep/ combinator is deprecated." Do you have any suggestions on how can I have global CSS and CSS libraries (like font awesome) available on the whole app ?

Thanks :)

回答1:

You could include the CSS font file globally, with the <link rel="stylesheet"> element.

That you'll have to import it locally in every Custom Element's <template>, in a <style> element, using the @import url CSS rule.

There's a running example in this answer.