-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Cookbook entry: Asset - Custom Version Strategy #5489
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
Cookbook entry: Asset - Custom Version Strategy #5489
Conversation
teohhanhui
commented
Jul 5, 2015
Q | A |
---|---|
Doc fix? | no |
New docs? | yes |
Applies to | 2.7+ |
Fixed tickets | #4982 |
94bd6ba
to
b5f5b71
Compare
1c48a83
to
79564d2
Compare
Default Package | ||
--------------- | ||
|
||
The default package is the `''` package. It is used when you do not specify |
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.
which package?
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's an empty string. I should make that clearer.
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.
Thank you!
great job @teohhanhui |
79564d2
to
4daa0f9
Compare
How to use a Custom Version Strategy for Assets | ||
=============================================== | ||
|
||
Out of the box, Symfony exposes configuration options which allow you to |
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.
I'd like to reword this paragraph. Instead of saying: "Symfony has some options to tweak things" ... we could say something like: "Symfony uses by default the XXX asset versioning strategy. Its behavior can be controlled with the xxx and yyy configuration options".
@teohhanhui thanks for writing this article. I like it a lot because I didn't know how to define your own asset versioning strategy 👍 |
4daa0f9
to
8d71390
Compare
Anything else that you need me to change? |
override the version strategy used by the default package, it is necessary | ||
to add a compiler pass. | ||
|
||
This example shows how to integrate with `gulp-buster`_. Note: busters.json |
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.
you could put this "Note" in a note block
cb1c157
to
254ddac
Compare
.. index:: | ||
single: Asset; Custom Version Strategy | ||
|
||
How to use a Custom Version Strategy for Assets |
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.
"use" must be capitalised
254ddac
to
2f8f74b
Compare
> | ||
<services> | ||
<service id="app.assets.buster_version_strategy" class="AppBundle\Asset\VersionStrategy\BusterVersionStrategy" public="false"> | ||
<argument type="collection"> |
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 is wrong. Your XML config is passing a single argument to BusterVersionStrategy which is an array with 2 elements, which does not match at all the config in other formats
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.
hmm no sorry. It does match them. I looked at it too fast. However, I don't think passing an array of option is worth it. Just configure things with normal arguments.
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.
Since PHP doesn't have named arguments, it's rather unfortunate that things become unrecognizable soon when you no longer know what's what.
2f8f74b
to
b770f79
Compare
Are we good yet? |
i would say: yes |
Wow, I really like this article! 👍 However, I think we should just move some contents around to show a more straight-forward implementation. What I have in mind to have short introduction which list the required steps:
I also think we should not focus on the default package. We can make the compiler pass generic and pass the package name as an argument to the constructor (we could just use the default package name in our example and add a sidebar which adds a short explanation about packages in general and the default package here). What do you think? |
Sidebar? |
@teohhanhui You can use a .. sidebar:: sidebar title
sidebar contents Technically, it will not be rendered as a sidebar on symfony.com, but more like an additional note. |
@teohhanhui Are you able to finish this one? :) |
return $versionized; | ||
} | ||
|
||
private function loadManifest(array $options) |
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.
$options is never used, should be removed.
But great work on this cookbook article! Is exactly what I was looking for.
@xabbuh Will try... |
Closing it in favor of #7141, which finishes this great article. Thanks @teohhanhui for your work. I've reused your original commits, so you'll get full credit for your work. |
…teohhanhui, javiereguiluz) This PR was merged into the 2.7 branch. Discussion ---------- Added "How to Use a Custom Version Strategy for Assets" This PR finishes the great work made by @teohhanhui in #5489. Commits ------- 1399967 Fixed a label name 981e82d Misc fixes a02f3b3 Added the version_strategy option to the config reference 2830ba0 Added the missing doc label 482fda5 Minor rewords and fixes f038483 Removed an unneeded change ab8fa54 Fixed a rebase error c59cff6 Moved the article to its new location 5971ce0 Removed an unneeded file 40dff64 Minor updates to the doc and service config 80d0ca2 Simplified the intro 4f530d8 Cookbook entry: Asset - Custom Version Strategy
… (xabbuh) This PR was merged into the 3.1 branch. Discussion ---------- Added "How to Use a Custom Version Strategy for Assets" Another attempt to finish @teohhanhui's great work from #5489. This will fix #6205. Commits ------- d3308be Added "How to Use a Custom Version Strategy for Assets"