在Bootstrap中使用加速的移动页面 [英] Using Accelerated Mobile Pages with Bootstrap

查看:105
本文介绍了在Bootstrap中使用加速的移动页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a website that uses Bootstrap. Technically, I'm using Bootstrap 4 at the moment. I want to leverage Accelerated Mobile Pages (AMP) in the publicly-facing parts of my page. However, I have several errors that I can't seem to shake. This has me wondering, can I even use Bootstrap with an Accelerated Mobile Page?

我甚至允许在加速的移动页面中使用JavaScript吗? Bootstrap在手机上的汉堡菜单中具有JavaScript.但是,当我运行验证器时,会看到类似以下的错误:

Am I even allowed to use JavaScript in Accelerated Mobile Pages? Bootstrap has JavaScript for the hamburger menu on mobile phones. Yet, when I run the validator, I see errors like:

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网站吗?

So, back to my question. Is it possible to have a Bootstrap 4 site that uses Accelerated Mobile Pages?

谢谢!

推荐答案

现在您不能在AMP中使用引导程序,因为它会插入很多不必要的CSS,并且AMP已针对性能进行了优化,但是您可以在AMP HTML中使用超赞的字体通过像这样包含它:

Right now you cannot use bootstrap with AMP because it inserts a lot of unnecessary CSS and AMP is optimized for performance, but you can use font-awesome in AMP HTML by including it like so:

<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

See the original issue on github: https://github.com/ampproject/amphtml/issues/2413

这篇关于在Bootstrap中使用加速的移动页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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