我有一个使用 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/