本文介绍了可以自托管AMP Project javascript吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想自己托管JavaScript,以确保我知道将代码分发给我的用户.是否有可能?会有后果吗?

I want to host the javascript myself to make sure I know the code being distributed to my users. Is it possible? Would there be consequences?

(我假设可以从 https://github.com/ampproject/amphtml )

推荐答案

这不是很简单,但是有马特·莫尔(Matt Mower)的非常详尽的指南.

It is not trivial, but there is a very detailed guide from Matt Mower.

本质上,您要做的就是在构建之前更改一些配置,修复html <meta><src>标记以指向您的托管版本,为动态加载的组件设置一个额外的<meta>标记,并根据您使用的amp插件,请配置服务器以替换插件javascript中的某些字符串.

Essentially, all you have to do is change some configurations before building, fix your html <meta> and <src> tags to point to your hosted version, set an extra <meta> tag for dynamically loaded components and, depending on the amp plugins you use, configure your server to replace some strings in the plugins javascript.

这篇关于可以自托管AMP Project javascript吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 03:05