【问题标题】:Load Multiple Files from maxcdn at once一次从 maxcdn 加载多个文件
【发布时间】:2018-01-25 02:25:37
【问题描述】:

我正在像这样使用来自 max cdn 的 bootstrap 和 font-awesome

 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
    crossorigin="anonymous">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">

如您所见,它为两个不同的文件发送了两个不同的请求,有没有办法在一个请求中加载这两个文件

【问题讨论】:

  • @SaurabhMistry 我不想在本地复制文件的内容我想保留在 maxcdn 中以获得缓存优势,并像下面的 Google 字体 API 一样一次请求这两个文件我一次加载两种字体` `` fonts.googleapis.com/css?family=Noto+Sans|Supermercado+One" rel="stylesheet"> ``` 有没有办法像上面那样一次加载两个文件

标签: html css performance cdn


【解决方案1】:

改用 jsdelivr 并合并多个文件:https://www.jsdelivr.com/features

<link rel="stylesheet" href="https://cdn.jsdelivr.net/combine/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css,npm/font-awesome@4.7.0/css/font-awesome.min.css">

【讨论】:

    猜你喜欢
    • 2011-04-15
    • 1970-01-01
    • 2010-09-18
    • 2018-06-28
    • 2016-11-03
    • 1970-01-01
    • 1970-01-01
    • 2018-02-12
    • 2011-12-31
    相关资源
    最近更新 更多