我有一个使用 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 站点?
谢谢!
原文由 user70192 发布,翻译遵循 CC BY-SA 4.0 许可协议
现在您不能将 bootstrap 与 AMP 一起使用,因为它插入了很多不必要的 CSS,并且 AMP 针对性能进行了优化,但是您可以通过像这样包含它来在 AMP HTML 中使用 font-awesome:
请参阅 github 上的原始问题: https ://github.com/ampproject/amphtml/issues/2413