使用@import时的子资源完整性 [英] Subresource Integrity when using @import

查看:28
本文介绍了使用@import时的子资源完整性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用@import时包含子资源完整性的语法是什么?

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

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

基本上,当使用上述的 @import 时,如何包括子资源的完整性和跨域参数?

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">

推荐答案

TL; DR :SRI是一种浏览器,CSS规则(如@import)是一个css.

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

使用@import时包含子资源完整性的语法是什么?

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

据我所知,当前的CSS规范(撰写本文时起草了CSS3)没有任何内容-定义了@import的用法-详细说明了CSS的SRI用法.

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.

基本上,当使用上述@import时,如何包括子资源的完整性和跨域参数?

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

这些参数定义浏览器如何获取资源并解释其合法性.这是在实现资源(js,css等)之前发生的.

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

外部资源:

这篇关于使用@import时的子资源完整性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆