Subresource Integrity when using @import

Viewed 1200

What is the syntax to include subresource integrity when using @import?

@import url(//use.fontawesome.com/releases/v5.3.1/css/all.css);

Besically how do I include the subresource integrity and crossorigin parameters when using @import like above?

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
1 Answers

TL;DR: SRI is a browser-thing, CSS at-rules (like @import) are a css-thing.

What is the syntax to include subresource integrity when using @import?

From what I can tell, there is nothing in the current CSS spec (CSS3 drafted as of writing this) - where usage of @import is defined - that details usage of SRI for css.

Besically how do I include the subresource integrity and crossorigin parameters when using @import like above?

Those parameters define how the browser fetches the resource and interprets its legitimacy. This happens before the resource is implemented (js, css, etc.).


External Resources:

Related