-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Upgrading to use AssetMapper 6.4 #1449
Upgrading to use AssetMapper 6.4 #1449
Conversation
This PR was squashed before being merged into the main branch. Discussion ---------- Remove Sass from custom CSS files This is mentioned by `@weaverryan` in #1449. We don't really use any Sass feature (except nesting and some variables). I've replaced Sass variables by CSS custom properties ... and removed the nesting by flattening all styles (we can readd nesting soon when native support is a big bigger than today: https://caniuse.com/?search=nesting). **Ryan**, if you agree on this, can we just merge it and then you rebase your PR? Thanks! Commits ------- 691859e Remove Sass from custom CSS files
I think committing those is going to create a worse DX experience. Developers download the demo and start tweaking it as a way of learning Symfony's best practices. I've been burned with accidentally having the public/assets and wondering why stimulus or css wasn't working.
That's a pretty amazing installation. And it makes sense -- download the PHP code, download the front-end assets, start the server. We shouldn't commit the front-end assets (js/css/images) for the same reason we don't commit the /vendor directory. |
I'm happy to help, maybe with the admin layout? |
@tacman I'm sorry but we don't plant to change the current way of working and installing with this demo. One of its best features is that it doesn't require anything except cloning and This feature has made the Symfony Demo to be usable in many different scenarios. For example, the PHP source code uses Symfony Demo in heir continuous benchmarks. That's only possible because of how easy is to install and use it. Thanks for understanding! |
Brainstorming: could composer install have an auto-script that installs the
assets, where it clears the cache?
…On Sun, Nov 19, 2023 at 9:24 AM Javier Eguiluz ***@***.***> wrote:
@tacman <https://github.com/tacman> I'm sorry but we don't plant to
change the current way of working and installing with this demo.
One of its best features is that it doesn't require anything except
cloning and composer install. No extra config. No extra asset installing
or generation. Nothing.
This feature has made the Symfony Demo to be usable in many different
scenarios. For example, the PHP source code uses Symfony Demo in heir
continuous benchmarks. That's only possible because of how easy is to
install and use it.
Thanks for understanding!
—
Reply to this email directly, view it on GitHub
<#1449 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEXIQMQ734VR4RLOHPM3HLYFIJDLAVCNFSM6AAAAAA7BVWWDCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJXHA3TANRXHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@tacman Wouldn't that be as simple as adding the assetmapper equivalent to https://github.com/weaverryan/symfony-demo/blob/upgrading-to-asset-mapper/composer.json#L95? |
@RubenKruiswijk Indeed, my applications all have "auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd",
"fos:js-routing:dump --format=js --target=public/js/fos_js_routes.js --callback=\"export default \"": "symfony-cmd"
}, Any for deployment, I have the same in either Procfile or app.json (to deploy to heroku / dokku)
"scripts": {
"dokku": {
"predeploy": "bin\/console importmap:install && bin\/console asset-map:compile",
"postdeploy": ""
}
}, I still think putting the public/assets in the repo is going to be a pain point for many developers. |
For heroku, I would recommend to do that in the |
And the |
To experiment with asset mapper & stenope, according to StenopePHP/Stenope#173 issue. Also, this will be the future of assets handling with Symfony, no more bundler implied : symfony/demo#1449 (comment)
c0ceec2
to
8d192cb
Compare
This PR was merged into the main branch. Discussion ---------- docs: document asset mapper and remove demo link Related to symfony/demo#1449 (review) Commits ------- a798bf7 docs: document asset mapper and remove demo link
Ryan, thanks for keep working on this 🙌 I recently upgraded a full Symfony app from Webpack Encore to AssetMapper. I have some comments and questions about AssetMapper and shared them at symfony/symfony#52939 When this PR is finished, I'll look in detail at Ryan's work to add or remove more comments/questions. Thanks! |
This is now ready! Thanks Javier for the other PR's to smooth my path :). In some future PR's, I think it's time to modernize a few things also (I'm sure you're already aware) - like going to Bootstrap 5, removing jQuery, etc. Some of the complexity of the PR is due to some older things being used, but I'm happy with the result! I don't know the demo super well, so I did my best to check things. |
Just asking: to keep the previous behavior where assets are fully compiled and ready to use out-of-the-box, shouldn't we commit the |
Very fair question. I added |
fa82c51
to
634f238
Compare
Ryan, thanks a lot for working so hard on this contribution 🙇 Let's merge it now so folks can play with it before tagging a new release. Thanks! |
This PR was merged into the main branch. Discussion ---------- Add a missing command to build Sass files After merging #1449 I saw this error when running the app: ![image](https://github.com/symfony/demo/assets/73419/5969dde6-0ecf-4ed4-bd37-14084371c2e4) Commits ------- 4137bb5 Add a missing command to build Sass files
Hi!
This converts from Encore to AssetMapper 6.4 (and also upgrading to Symfony 6.4 in general). This was the final product of a live stream walking through this process - https://www.youtube.com/watch?v=pyj1hvhcxGc
There are still some TODOs to finish. The biggest is the first, as Sass is quite embedded in there.
A) convert Sass->CSS (not a requirement for AssetMapper, but Javier & I talked about this). Then remove SassBundle & bootstrap in. Much of this was done, Sass kept just for Bootstrap.composer.json
. Probably many Sass variables should be converted to CSS variables. See Remove Sass from custom CSS files #1450 and Import the entire Bootstrap styles #1452B) InIt's fine how it is. When we upgrade, perhaps we could look at it then.assets/app.js
, I should just be able to import from the individualbootstrap
package instead of requiring each partpublic/assets/
orassets/vendor/
so the code works after clone with ZERO other commands. Else, the user will need to runimportmap:install
.devcontainer.json
admin
entrypoint & layoutIt's a busy month! If anyone is interested in trying to fix any of the above points, just let me know here or on Slack. I'd be more than happy to coach someone through them.
Cheers!