简体   繁体   English

我可以将Addthis JS文件编译到自己的本地JS中吗?

[英]Can I compile the Addthis JS file into my own local JS?

When you add Addthis share buttons to your site, Addthis provides this script: 当您将Addthis共享按钮添加到站点时,Addthis提供以下脚本:

<script type="text/javascript">var addthis_config = {"data_track_addressbar":true}</script>

<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=MYADDTHISPROFILEID"></script>

In this case "MYADDTHISPROFILEID" represents my public ID that Addthis generated for my Profile. 在这种情况下,“ MYADDTHISPROFILEID”代表Addthis为我的个人资料生成的我的公共ID。

I want to reduce the amount of requests I'm making so I'd like to use Grunt to compile the Addthis widget script into the rest of my JS. 我想减少请求的数量,所以我想使用Grunt将Addthis小部件脚本编译到我的JS的其余部分中。 Is that possible? 那可能吗?

Or is the Public ID required? 还是需要公共ID? Is it the ID that associates my website with my Addthis account? 是将我的网站与我的Addthis帐户相关联的ID? I want to be sure I can still track analytics. 我想确保我仍然可以跟踪分析。

Unfortunately, we do not recommend compiling addthis_widget.js into your code since we update that file fairly often with fixes/updates. 不幸的是,我们不建议将addthis_widget.js编译到您的代码中,因为我们经常通过修订/更新来更新该文件。 If you were to compile it into your code, you would be stuck on an older version and you wouldn't get updates. 如果要将其编译为代码,则将停留在较旧的版本上,并且不会获得更新。 If it makes you feel any better, our assets are highly cached, so they really shouldn't add too much load for your users since all the js/css files are probably already available on their browser. 如果让您感觉更好,我们的资产将被高度缓存,因此它们确实不应为您的用户增加过多的负担,因为所有js / css文件可能已经在其浏览器上可用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM