Home > Net >  assets in Symfony6 - manifest.json missing
assets in Symfony6 - manifest.json missing

Time:06-02

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.

CodePudding user response:

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).

  • Related