bolt / core

🧿 Bolt 5 core
https://boltcms.io
MIT License
532 stars 157 forks source link

After installing and activate WebpackEncore i can't access to current theme #3351

Open celtic34fr opened 1 year ago

celtic34fr commented 1 year ago

I installed and activated Webpack Encore (last version) according to the documentation (for Bolt CMS 5.0). After, I create a new Controller with its template. I want to base this template on the _master.twig template from the base-2021 theme. But the application cannot find the base-2021 theme resources (CSS and JavaScript files). Even if I specify the name of a package or not in the asset directive of TWIG, I always have the same result: with package name:


...
    <link rel="stylesheet" href="{{ asset('css/base-2021.css', 'theme') }}"/>
...```
without package name:
```An exception has been thrown during the rendering of a template ("Asset manifest file "/...../public/build/manifest.json" does not exist. Did you forget to build the assets with npm or yarn?" ).```

I think the documentation is not precise enough or there is a malfunction in Bolt CMS when Webpack Encore is enabled. That's why I'm submitting this problem as a bug rather than an error in the documentation.

Details
-------

| Question                                              | Answer
|------------------------------------------------------ | ------
| Relevant Bolt Version                                 | 5.1.18
| Install type                                          |  Composer install 
| <abbr title="Backwards Compatibility">BC</abbr> Break | yes/no : I don't know
| PHP version                                           | 8.1 |
| Web server                                            | Built-in, version [ Symfony CLI version 5.4.17 ]
| For UX/UI issues                                      | Firefox 106.0.5 (x64 - Linux Ubuntu 22.04)
bobdenotter commented 1 year ago

It's not supposed to work like that, i think.. Webpack is for bolt itself. The themes should be agnostic, and separate from that. What are you trying to achieve?

celtic34fr commented 1 year ago

Ok, but that shouldn't interfere with the mechanics implemented by Bolt. Do I understand that using Webpack breaks everything I can do to use a theme for the front end of my project? Because before installing Webpack, I was able to use a theme that I develop from the theme skeleton that comes with Bolt. What do you recommend doing if you want to integrate Webpack into a Bolt project? Should you rather work without Webpack to have access to all of Bolt's features?

jbarbin commented 5 months ago

Hello @celtic34fr, i don't know if you still need help but I followed that documentation and all works fine for me : https://docs.boltcms.io/5.2/howto/encore-setup

I hope this could help you :)