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

[Asset] Version as service #17532

Closed
wants to merge 3 commits into
base: master
from

Conversation

Projects
None yet
4 participants
@ewgRa
Contributor

ewgRa commented Jan 25, 2016

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR

While I working on #14832 I realize that all this problems and hidden magic can be avoided, if we will have ability to set asset version strategy as service.

This PR implementation of this idea.

Now it is possible to do something like this:

framework:
    assets:
        version_strategy: assets.custom_version_strategy
        base_urls: http://cdn.example.com
        packages:
            foo:
                base_urls: ["https://example.com"]
                version_strategy: assets.custom_version_strategy        

There is can be some conflicts with #16511 when it will be in master

->ifTrue(function ($v) {
return (null !== $v['version_strategy'] && null !== $v['version']);
})
->thenInvalid('You cannot use version_strategy and version settings in assets configuration.')

This comment has been minimized.

@fabpot

fabpot Jan 26, 2016

Member

You cannot use both "version_strategy" and "version" at the same time under "assets".

->ifTrue(function ($v) {
return (null !== $v['version_strategy'] && null !== $v['version']);
})
->thenInvalid('You cannot use version_strategy and version settings in same package.')

This comment has been minimized.

@fabpot

fabpot Jan 26, 2016

Member

You cannot use both "version_strategy" and "version" at the same time under "assets" for the "%s" package.

if (null === $package['version']) {
if (null !== $package['version_strategy']) {
$version = new Reference($package['version_strategy']);
} else if (null === $package['version']) {

This comment has been minimized.

@fabpot

fabpot Jan 26, 2016

Member

elseif

'version_strategy' => 'foo',
),
),
));

This comment has been minimized.

@fabpot

fabpot Jan 26, 2016

Member

You should unindent.

),
),
));
}

This comment has been minimized.

@fabpot

fabpot Jan 26, 2016

Member

same as above

@fabpot

This comment has been minimized.

Member

fabpot commented Jan 26, 2016

👍

@ewgRa

This comment has been minimized.

Contributor

ewgRa commented Jan 26, 2016

@fabpot done, test fails seems unrelated (also appveyor marked as green, but it have failed tests)

Are you expect invalid message like this - "for the "{"base_urls":["//example.com"],"version":1,"version_strategy":"foo","version_format":null,"base_path":""}" package" ?

@fabpot

This comment has been minimized.

Member

fabpot commented Jan 26, 2016

Packages have names, right?

@ewgRa

This comment has been minimized.

Contributor

ewgRa commented Jan 26, 2016

@fabpot right. But "thenInvalid" function just json encode node.

If you want package name under %s, I can check how it can be done.

@fabpot

This comment has been minimized.

Member

fabpot commented Jan 26, 2016

If getting the package name is possible, that would be better, if not, just keep it without anything. Having the config in there would look weird.

@ewgRa

This comment has been minimized.

Contributor

ewgRa commented Jan 26, 2016

@fabpot I remove package name, maybe in next PR provide solution. On first look it is not so easy to output there package name.

@fabpot

This comment has been minimized.

Member

fabpot commented Jan 26, 2016

Thank you @ewgRa.

@fabpot fabpot closed this in f1cdc6f Jan 26, 2016

@ewgRa ewgRa deleted the ewgRa:assets_version_as_service branch Jan 26, 2016

@fabpot fabpot referenced this pull request May 13, 2016

Merged

Release v3.1.0-BETA1 #18776

@xabbuh xabbuh referenced this pull request Dec 13, 2016

Merged

Revert the merge of #7141 #7247

xabbuh added a commit to symfony/symfony-docs that referenced this pull request Dec 13, 2016

minor #7247 Revert the merge of #7141 (xabbuh)
This PR was merged into the 2.7 branch.

Discussion
----------

Revert the merge of #7141

I shouldn't have merged #7141 into the `2.7` branch as the related code PR (symfony/symfony#17532) was released with Symfony 3.1.

Commits
-------

0f7c7d5 Revert "minor #7141 Added "How to Use a Custom Version Strategy for Assets" (teohhanhui, javiereguiluz)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment