-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Switch from Encore to AssetMapper #1423
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
Comments
This looks like a good idea. Let's ask @weaverryan if he thinks that this is OK for a project like this. Our requirements are that the application is fully usable (all CSS and JS) just by downloading it (the end user should do nothing: run no command, configure nothing, etc.) Also, don't know if the application should be offline or not. It should probably be offline because this demo app is used to do benchmarks (even by the PHP core team), so maybe it has to be fully usable without Internet connection. So maybe we need to use the So, what are your thoughts? Thanks! |
Diving into this a bit deeper, I see that the search component is already set up as a Live Component, and indeed base already includes the importmap calls: {% block stylesheets %}
<link rel="stylesheet" href="{{ asset('styles/app.css') }}">
{{ encore_entry_link_tags('app') }}
{% endblock %}
{% block javascripts %}
{{ importmap() }}
{{ encore_entry_script_tags('app') }}
{% endblock %} So I installed the asset mapper component, then symfony ux-chart. Everything looked good, it ran the importmap:require commands
As importmap was already being called in base, I didn't do anything, but when I loaded a page with a render_chart() twig call, I didn't get anything. Then I made the mistake of running yarn install --force && yarn dev, and everything broke. So two questions: Can webpack and assetmapper be installed in the same project? And what is the level of effort to get rid of webpack altogether? If we did that, we could also use it as an opportunity to upgrade to bootstrap 5, drop jQuery, and use more Symfony UX components. I see that Ryan is giving a talk today on this exact topic. |
How about at least documenting how to use assetmapper instead of webpack, even if it's a separate branch or even just a note. I'm sure I'm not the only one that installs the demo with every new Symfony version to see what the latest best practices are. There are only a handful of external assets used, even manually installing them would be an interesting exercise / tutorial. And, of course, seeing how webpack and assetmapper play together during the migration. I can't wait to drop the build system, so seeing this demo without Webpack would be awesome. @weaverryan ? |
We should target this for 6.4 as there are a few changes from 6.3 -> 6.4. If anyone wants to tackle this, I'd be happy to consult for any questions you have.
For 6.4, you WILL need to run a |
Where are the 6.4 changes documented? I'd like to help, even if it's just with testing.
|
Definitely not documented anywhere yet as they're still happening. You can watch ux.symfony.com being adapted here https://github.com/symfony/ux/tree/2.x/ux.symfony.com For the error above specifically, |
Thanks. Are there instructions related to css? Even just an example would be great. |
Check ux.symfony.com again in a week or so - we've just got too many open AssetMapper PR's right now on symfony/symfony - it's a super moving target.
But yes, you can |
Bumped my playground app to 6.4 and saw this:
Woohoo!! CSS! Not sure where to put this question. Is there a way to select another CDN besides jsdelivr? Like Skypack? Maybe an option for importmap:require, or an environment variable? |
Once this PR is merged symfony/symfony#51786 all files will be downloaded locally (like Composer). No more CDN usage. However, behind the scenes, we download from jsdelivr. Your related issue is the first time i've heard of there being a problem with a package from jsdelivr: we're using them because all of the other ones seem to have problems / work inconsistently. |
This issue can be closed |
Uh oh!
There was an error while loading. Please reload this page.
Since the demo is running Symfony 6.3, what do you think of using AssetMapper instead of Encore?
https://symfony.com/blog/new-in-symfony-6-3-assetmapper-component
It seems like it'd be so much easier to set up than encore, this would be a wonderful project to show off as an example of how to use it.
Thanks.
The text was updated successfully, but these errors were encountered: