Symfony6中的资产 - 清单。

发布于 2025-02-04 05:29:20 字数 675 浏览 4 评论 0原文

我正在学习Symfony,跟随Tuto。问题是,是与Symfony5一起使用,我正在使用Symfony6。 图托说要在公共目录中创建一个资产文件夹,我做到了:

“

当我使用twig调用我的bootstrap.css时: < link href =“ {{Assets('Assets/css/css/bootstrap.min.css')}}}}}}“ rel =“ stylesheet”>

我得到此错误: 在渲染模板的渲染过程中抛出了一个例外(“资产清单文件”/Applications/mamp/htdocs/laboutiquefr/public/public/build/manifest.json不存在。您是否忘记忘记使用NPM构建资产还是纱?”)。

我的问题是:

  • 如何修复此清单。
  • 我看到一个带有Symfony6的资产文件夹,该文件夹与Symfony5的tuto上不存在。我应该使用这个文件夹吗?

非常感谢。

I'm learning Symfony, following a tuto. Problem is, it is with Symfony5 and i'm using Symfony6.
The tuto says to create an assets folder in public directory, which I did :

structure

When I use Twig to call my bootstrap.css like this :
<link href="{{ assets('assets/css/bootstrap.min.css' )}}" rel="stylesheet">

I get this error :
An exception has been thrown during the rendering of a template ("Asset manifest file "/Applications/MAMP/htdocs/laboutiquefr/public/build/manifest.json" does not exist. Did you forget to build the assets with npm or yarn?").

My questions are :

  • How do I fix this manifest.json error ?
  • I see an assets folder with Symfony6, which is not on the tuto with Symfony5. Should I use this folder instead ?

Thank you very much.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

羅雙樹 2025-02-11 05:29:20

使用命令使用命令来更新CSS/JS/映像时,需要构建资产。

在使用YARN或NPM运行手表时,

这应该建立您的资产(并创建清单。引用这些资产)。

You need to build asset when updating css/js/images by using the command:

yarn encore dev --watch when using yarn or npm run watch when using npm.

This should build your assets (and create a manifest.json referencing those assets).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文