html - 将加速移动页面与 Bootstrap 结合使用

标签 html css pagespeed accelerated-mobile-page

我有一个使用 Bootstrap 的网站。从技术上讲,我目前正在使用 Bootstrap 4。我想在我页面的面向公众的部分中利用加速移动页面 (AMP)。但是,我有几个错误似乎无法摆脱。这让我想知道,我什至可以将 Bootstrap 与加速移动页面一起使用吗?

我什至可以在 Accelerated Mobile Pages 中使用 JavaScript 吗? Bootstrap 为手机上的汉堡包菜单提供了 JavaScript。然而,当我运行验证程序时,我看到如下错误:

The attribute 'href' in tag 'link rel=stylesheet for fonts' is set to the invalid value 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/css/bootstrap.min.css'.
The attribute 'rel' in tag 'link rel=' is set to the invalid value 
The tag 'script' is disallowed except in specific forms.

所以,回到我的问题。是否可以拥有使用加速移动页面的 Bootstrap 4 站点?

谢谢!

最佳答案

现在您不能将 bootstrap 与 AMP 一起使用,因为它插入了很多不必要的 CSS,并且 AMP 针对性能进行了优化,但是您可以通过像这样包含它来在 AMP HTML 中使用 font-awesome:

<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet">

请参阅 github 上的原始问题:https://github.com/ampproject/amphtml/issues/2413

关于html - 将加速移动页面与 Bootstrap 结合使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38063272/

相关文章:

html - 更改包裹在 <a> 中的悬停元素符号颜色

c# - Google PageSpeed API dotnet .net

java - 使用 GWT 时不相关的 Google App Engine API?

jquery - 单击按钮后div从左侧滑动

html - 垂直对齐包含在 <td> 中的 <div>

javascript - 验证 ASP 经典 DDL

html - <div> 如何扩展其 <li> 父元素的长度?

css - Mac 上的 Chrome 和 Windows 上的 Chrome 有什么区别?

javascript - 大型 HTML 文档对页面速度有什么好处吗?

javascript - AJAX jquery 没有响应并显示 div