Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom assets directory for webpack resources #962

Open
rskuipers opened this issue Dec 27, 2022 · 2 comments
Open

Support custom assets directory for webpack resources #962

rskuipers opened this issue Dec 27, 2022 · 2 comments

Comments

@rskuipers
Copy link

Sulu CMS separates its assets into assets/admin and assets/website, this means when installing Encore within a Sulu CMS install you will have to change a bunch of paths: https://docs.sulu.io/en/latest/cookbook/webpack-encore.html

This isn't my main issue, I think this is acceptable for an initial setup. But I do think we can improve what happens when you composer require a symfony bundle that provides stimulus controllers.

In the Sulu + Encore setup, the controllers.json file lives in assets/website/controllers.json. But since this path is hardcoded here:

private function registerWebpackResources(array $phpPackages)
{
if (!file_exists($controllersJsonPath = $this->rootDir.'/assets/controllers.json')) {
return;
}

The controllers.json is not updated automatically and there's no output telling you to manually do this either. So you're left a little lost in what is still missing. Also, figuring out what to manually add in controllers.json is quite tricky since most existing UX bundles don't document this manual setup.

Before I start hacking away at a PR, any suggestions how we can solve this properly? Or do we accept that this is not configurable and those who use custom paths just have to deal with it?

Thank you in advance.

@fbourigault
Copy link

What about making this path configurable in extra.symfony of the composer.json?

@rskuipers
Copy link
Author

That would be my suggestion as well 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants