Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Asset] Add CachedVersionStrategy to decorate any Asset version strategy #36371

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Rename cache_version to cache
  • Loading branch information
GromNaN committed May 6, 2020
commit 7182255a9b65b5bae160e5a186c0dd684411eb0d
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ private function addAssetsSection(ArrayNodeDefinition $rootNode)
->scalarNode('version')->defaultNull()->end()
->scalarNode('version_format')->defaultValue('%%s?%%s')->end()
->scalarNode('json_manifest_path')->defaultNull()->end()
->booleanNode('cache_version')->defaultFalse()->end()
->booleanNode('cache')->defaultFalse()->end()
->scalarNode('base_path')->defaultValue('')->end()
->arrayNode('base_urls')
->requiresAtLeastOneElement()
Expand Down Expand Up @@ -623,7 +623,7 @@ private function addAssetsSection(ArrayNodeDefinition $rootNode)
->end()
->scalarNode('version_format')->defaultNull()->end()
->scalarNode('json_manifest_path')->defaultNull()->end()
->scalarNode('cache_version')->defaultFalse()->end()
->scalarNode('cache')->defaultFalse()->end()
->scalarNode('base_path')->defaultValue('')->end()
->arrayNode('base_urls')
->requiresAtLeastOneElement()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ private function registerAssetsConfiguration(array $config, ContainerBuilder $co
$defaultVersion = $this->createVersion($container, $config['version'], $config['version_format'], $config['json_manifest_path'], '_default');
}

if (false !== $config['cache_version']) {
if ($config['cache']) {
$defaultVersion = $this->decorateVersionStrategyWithCache($container, $defaultVersion);
}

Expand All @@ -1015,7 +1015,7 @@ private function registerAssetsConfiguration(array $config, ContainerBuilder $co
$format = $package['version_format'] ?: $config['version_format'];
$version = isset($package['version']) ? $package['version'] : null;
$version = $this->createVersion($container, $version, $format, $package['json_manifest_path'], $name);
if (false !== $package['cache_version']) {
if ($package['cache']) {
$version = $this->decorateVersionStrategyWithCache($container, $version);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
<xsd:attribute name="version" type="xsd:string" />
<xsd:attribute name="version-format" type="xsd:string" />
<xsd:attribute name="json-manifest-path" type="xsd:string" />
<xsd:attribute name="cache-version" type="xsd:string" />
<xsd:attribute name="cache" type="xsd:string" />
</xsd:complexType>

<xsd:complexType name="package">
Expand All @@ -158,7 +158,7 @@
<xsd:attribute name="version" type="xsd:string" />
<xsd:attribute name="version-format" type="xsd:string" />
<xsd:attribute name="json-manifest-path" type="xsd:string" />
<xsd:attribute name="cache-version" type="xsd:string" />
<xsd:attribute name="cache" type="xsd:string" />
</xsd:complexType>

<xsd:complexType name="form-resources">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function testAssetsCanBeEnabled()
'base_urls' => [],
'packages' => [],
'json_manifest_path' => null,
'cache_version' => false,
'cache' => false,
];

$this->assertEquals($defaultConfig, $config['assets']);
Expand Down Expand Up @@ -440,7 +440,7 @@ protected static function getBundleDefaultConfig()
'base_urls' => [],
'packages' => [],
'json_manifest_path' => null,
'cache_version' => false,
'cache' => false,
],
'cache' => [
'pools' => [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
],
'cached' => [
'json_manifest_path' => 'https://cdn.example.com/manifest.json',
'cache_version' => true,
'cache' => true,
],
],
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</framework:package>
<framework:package name="json_manifest_strategy" json-manifest-path="/path/to/manifest.json" />
<framework:package name="remote_manifest" json-manifest-path="https://cdn.example.com/manifest.json" />
<framework:package name="cached" json-manifest-path="https://cdn.example.com/manifest.json" cache-version="true" />
<framework:package name="cached" json-manifest-path="https://cdn.example.com/manifest.json" cache="true" />
</framework:assets>
</framework:config>
</container>
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ framework:
json_manifest_path: 'https://cdn.example.com/manifest.json'
cached:
json_manifest_path: 'https://cdn.example.com/manifest.json'
cache_version: true
cache: true
Morty Proxy This is a proxified and sanitized view of the page, visit original site.