Link javascript 来自 Symfony 中的外部包 (noty),没有 AppKernel

Link javascript from external bundle (noty) in Symfony, no AppKernel

我想使用 noty 包,但找不到指南。 据我了解,我只需要 link 从捆绑包中获取它。 在旧问题中,人们建议将其添加到 AppKernel,但此包的根路径中没有 *.php。

我想保留 bundle 的路径,不想移动到 web 文件夹。

据我所知,noty 是一个 ,而不是 (我假设您使用的是 https://packagist.org/packages/needim/noty).

一个 bundle 是专门为 Symfony 构建的,所以正确的使用方法是像其他人提到的那样包含在 AppKernel.php 中。

A library 不是专门为 Symfony 构建的,所以你只需通过 Composer 包含它然后(因为它是一个 jQuery 插件)你必须初始化将其添加到您的 Twig 基本模板中并根据需要使用它。