简体   繁体   English

在NodeJS服务器上本地使用TypeKit

[英]Using TypeKit locally on a NodeJS server

I can't seem to get TypeKit working on my local node webserver. 我似乎无法让TypeKit在我的本地节点webserver上工作。

I've added localhost and localhost:1337 to my list of domains (not sure if the one with the port is making a difference though). 我已将localhostlocalhost:1337添加到我的域列表中(不确定具有该端口的域是否有所作为)。

The webserver is running on 1337, it has the typekit script with the correct kit ID, but the typekit .js library always comes back with 404. Web服务器在1337上运行,它具有带有正确工具包ID的typekit脚本,但typekit .js库总是带有404。

Make sure you are clicking the green 'Publish' button after editing your Kit Setting Domains (after clicking 'Save Settings'). 确保在编辑套件设置域后单击绿色的“发布”按钮(单击“保存设置”后)。 If you don't do this, "Changes won't be live on your site until you publish them." 如果您不这样做,“在您发布之前,更改将不会在您的网站上发布。”

For some reason I could not get Typekit to work on localhost just by adding localhost to the list of domains (reason is still unknown to me, decided not to care too much about it). 出于某种原因,我无法通过将localhost添加到域列表中来使Typekit在localhost上工作(原因对我来说仍然是未知的,决定不要过多关注它)。

What I ended up doing as a quick solution is just set a wildcard to my list of domains in Typekit so instead of having: 我最后做的一个快速解决方案就是在Typekit中为我的域列表设置一个通配符,而不是:

staging.mysite.com

I set: 我设置:

*.mysite.com

Then, on my own computer i added a non existing subdomain to my /etc/hosts , ie: 然后,在我自己的计算机上,我向/etc/hosts添加了一个不存在的子域,即:

$ sudo vim /etc/hosts

(opens my Host Database configuration) (打开我的主机数据库配置)

At the end of the file I added: 在文件的末尾,我添加了:

127.0.0.1 localdev.mysite.com

Opening localdev.mysite.com:8000 now shows my working copy without the annoying 403 error I previously had (not 404 as in your case). 打开localdev.mysite.com:8000现在显示我的工作副本没有我之前遇到的恼人的403错误(在你的情况下不是404)。 I hope this will prove helpful for somebody. 我希望这对某些人有用。

If you are getting a 404 error, then you have not published your kit. 如果您收到404错误,那么您尚未发布工具包。

If you are getting a 403 error, then you need to whitelist your domain (without a specified port -- localhost:8080 becomes localhost). 如果您收到403错误,则需要将您的域列入白名单(没有指定的端口 - localhost:8080将成为localhost)。

https://forums.adobe.com/thread/2077663 https://forums.adobe.com/thread/2077663

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

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