-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Hello AssetMapper Documentation #18370
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
Conversation
|
||
frontend/asset_mapper/installation | ||
frontend/asset_mapper/usage | ||
frontend/asset_mapper/* | ||
frontend/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bottom of https://symfony.com/doc/current/frontend.html is currently "wonky". I think the intention was for the the first, :hidden
toctree
to "load" all of the encore
stuff into the toctree
... and then this bottom toctree
would only load anything "remaining". In practice, it would render everything.
So, I reduced this to just ONE toctree
, which is :hidden:
. The 2 documents that are outside of encore/*
were added manually under the Other Front-End Articles
section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fun fact, including documents in a toctree entry is no longer relevant with the PHP based parser IIRC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That IS a fun fact, thank you!
frontend.rst
Outdated
create static CSS and JS files in your ``public/`` directory directly and | ||
include them in your templates. | ||
Symfony Frontend Tools | ||
====================== |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This document is now a bit more important than before. On https://symfony.com/doc/current/index.html, I don't think we link to it at all. After we merge this, we probably should.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Webpack Encore" is linking to it. We should probably do the same as with Security and call it "Introduction"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I added some TODO to the PR description for post-merge changes to the main documentation page.
This is ready to go! About the Code Blocks failure - I've added symfony-tools/symfony-application#16 - but it looks like it's using the 5.4 version of the app, and I'm not sure why. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. A cool feature just got cool new documentation 😎
frontend.rst
Outdated
create static CSS and JS files in your ``public/`` directory directly and | ||
include them in your templates. | ||
Symfony Frontend Tools | ||
====================== |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Webpack Encore" is linking to it. We should probably do the same as with Security and call it "Introduction"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ryan, thanks a lot for this massive contribution. The new docs are fun to read and super easy to follow. Thanks!
I really like all the hard work on assetmapper . its really great, just i wonder is there a way to extend functionality of assetmapper like some php handlers ? i didnt see it in documentation, missed out or not a functionality yet ? |
general question about the AssetMapper stuff |
Tweaks handled! Thank you for the HUGE review on a big document (and very fast) ❤️
What kind of extending are you imagining? There is an "asset compiler" system where you can parse and modify the contents of any file in asset mapper. It's a bit more advanced, so I didn't document it on this first pass. You can also decorate a "public path resolver" to change the final, public paths of files.
Yes :). This is in the new docs. Fortunately, you can download a standalone |
Thanks for awesome documentation and good work, easy to read and understandable. Thought things like, people can have tools for custom optimizations on css or js for special to their projects, I wondered is't possible to use assetmapper with custom optimization tools at compile time. |
The answer is probably yes, and it would be by creating an asset compiler (you can see a few in core - one for js files and 2 for CSS files). With these, you could take the source of a file and change it - like minifying it (not, while that’s possible, that’s better left to the server). In practice, I don’t know yet how useful this stuff will be for that purpose… we’ll see what people come up with. And we may need to add even more hook points depending on what people want to do. |
Thank you so much for showing way of do this. :) At my side, i have my own typescripts and i like to compile them before deploy automatically. normally i do it with script. collecting all typescripts compile them. some optimizations with css (minification removing unused stuff etc) html and js afterwards and publish the latest html css and js files. what assetmapper give duplicate of this work and also in better some places. thats why i thought it can be good idea to merge them (need to check possible or not) . at server every request doing minification even with locks scary for my part when there can be 1000 page request same time. i prefer to do it offline before deployment. And assetmapper really make this things more less config necessary way. i hope there will more hook points :) Assetmapper Itself is great idea honestly. |
I think this is ready to go :) |
frontend/asset_mapper.rst
Outdated
{% endblock %} | ||
|
||
If you'd rather download the CSS file and include it locally, you can do that. | ||
For example, you could download it to ``assets/vendor/bootstrap.min.css`` and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this a manual process or done via a command?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently manually - I've clarified the wording to be more clear :)
FYI - this is still ready to go, but I also added a new section about page-specific JavaScript, per @bendavies question on Slack :) |
This PR was squashed before being merged into the 6.3 branch. Discussion ---------- Hello AssetMapper Documentation Hi! I wrote some docs! This covers all the important things that I can think of right now :). I'd appreciate any reviews. ### Post-Merge Symfony.com TODOs: * [ ] On https://symfony.com/doc/current/index.html, add an `Introduction` link under `Front-End` that links to https://symfony.com/doc/current/frontend.html * [ ] Update the `Webpack Encore` link on that same page to... probably https://symfony.com/doc/current/frontend.html#webpack-encore ? Thanks! Commits ------- ef77936 Hello AssetMapper Documentation
This will download the package into an ``assets/vendor/`` directory and update | ||
the ``importmap.php`` file to point to it. You *should* commit this file to | ||
your repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the vendor directory should also be committed or should be gitignored ? In that case, is the recipe add the folder to gitignore ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! You can't actually commit directories to git - only files. But the meaning here is that you "commit the vendor/ directory and all files inside to git". So the assets/vendor/
directory should NOT be ignored :)
Hi, |
The PR has been merged, but GitHub does not show as is |
Thanks 👍 |
How can we manage fonts? Is it different with AssetMapper? Is there a good practice? |
Good question - it's the same as 3rd party CSS: A) Search on jsdelivr.com for the font you want. from fontsource - e.g. https://www.jsdelivr.com/package/npm/@fontsource/roboto It's "simple" but I would love if it were easier - it may be for 6.4. |
Hi!
I wrote some docs! This covers all the important things that I can think of right now :). I'd appreciate any reviews.
Post-Merge Symfony.com TODOs:
Introduction
link underFront-End
that links to https://symfony.com/doc/current/frontend.htmlWebpack Encore
link on that same page to... probably https://symfony.com/doc/current/frontend.html#webpack-encore ?Thanks!