我正在學習 Symfony,遵循 tuto。問題是,它與 Symfony5 一起使用,而我正在使用 Symfony6。tuto 說要在公共目錄中創建一個資產檔案夾,我這樣做了:

當我使用 Twig 像這樣呼叫我的 bootstrap.css 時:
<link href="{{ assets('assets/css/bootstrap.min.css' )}}" rel="stylesheet">
我收到此錯誤:
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?").
我的問題是:
- 如何修復此 manifest.json 錯誤?
- 我看到一個帶有 Symfony6 的資產檔案夾,它不在 Symfony5 的教程中。我應該改用這個檔案夾嗎?
非常感謝。
uj5u.com熱心網友回復:
您需要在更新 css/js/images 時使用以下命令構建資產:
yarn encore dev --watch使用紗線或npm run watch使用 npm 時。
這應該構建您的資產(并創建一個 manifest.json 參考這些資產)。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/485146.html
