Symfony';s WebLink组件:如何在twig中正确集成dns_预取和预连接

Symfony';s WebLink组件:如何在twig中正确集成dns_预取和预连接,symfony,twig,symfony-components,Symfony,Twig,Symfony Components,我正试图通过集成symfonyweblink组件来提高我的站点性能 我现在已经在css ans js文件中使用了preload()函数,性能确实得到了提高,对此我感到非常高兴 但是我在任何地方都找不到任何关于dns_prefetch()和preconnect()函数如何工作的细枝示例 在集成WebLink之前,是这样的: <link rel="dns-prefetch" href="https://www.googletagmanager.com"

我正试图通过集成symfonyweblink组件来提高我的站点性能

我现在已经在css ans js文件中使用了preload()函数,性能确实得到了提高,对此我感到非常高兴

但是我在任何地方都找不到任何关于dns_prefetch()preconnect()函数如何工作的细枝示例

在集成WebLink之前,是这样的:

<link rel="dns-prefetch" href="https://www.googletagmanager.com" />
<link rel="dns-prefetch" href="https://www.googleadservices.com" />
<link rel="dns-prefetch" href="https://cdn.scarabresearch.com" />
<link rel="dns-prefetch" href="https://www.google.be" />
<link rel="dns-prefetch" href="https://www.google.co.uk" />
<link rel="dns-prefetch" href="https://gum.criteo.com" />

集成WebLink组件后,这就是我现在拥有的

{#
 # Use preconnect when you are sure it will be used every time (DNS + TCP + TLS)
 #}
<link rel="preconnect" href="{{ preconnect('https://www.googletagmanager.com') }}" />
<link rel="preconnect" href="{{ preconnect('https://www.googleadservices.com') }}" />
<link rel="preconnect" href="{{ preconnect('https://cdn.scarabresearch.com') }}" />

{#
 # Use dns_prefetch if you are NOT sure it will be used every time (DNS lookup only)
 #}
<link rel="dns-prefetch" href="{{ dns_prefetch('https://www.google.be') }}" />
<link rel="dns-prefetch" href="{{ dns_prefetch('https://www.google.co.uk') }}" />
<link rel="dns-prefetch" href="{{ dns_prefetch('https://gum.criteo.com') }}" />
{#
#如果您确定每次都会使用预连接(DNS+TCP+TLS),请使用预连接
#}
{#
#如果您不确定每次都会使用dns_预取(仅限dns查找),请使用dns_预取
#}
所以问题很简单:
这是细枝的正确符号吗

我不想预连接两次(如果可能的话?)