Skip to content

Commit 0fa18e4

Browse files
committed
[AssetMapper] Adding an option (true by default) to not publish dot files
1 parent c9e4544 commit 0fa18e4

File tree

5 files changed

+11
-1
lines changed

5 files changed

+11
-1
lines changed

DependencyInjection/Configuration.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,11 @@ private function addAssetMapperSection(ArrayNodeDefinition $rootNode, callable $
899899
->prototype('scalar')->end()
900900
->example(['*/assets/build/*', '*/*_.scss'])
901901
->end()
902+
// boolean called defaulting to true
903+
->booleanNode('exclude_dotfiles')
904+
->info('If true, any files starting with "." will be excluded from the asset mapper')
905+
->defaultTrue()
906+
->end()
902907
->booleanNode('server')
903908
->info('If true, a "dev server" will return the assets from the public directory (true in "debug" mode only by default)')
904909
->defaultValue($this->debug)

DependencyInjection/FrameworkExtension.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1351,7 +1351,8 @@ private function registerAssetMapperConfiguration(array $config, ContainerBuilde
13511351

13521352
$container->getDefinition('asset_mapper.repository')
13531353
->setArgument(0, $paths)
1354-
->setArgument(2, $excludedPathPatterns);
1354+
->setArgument(2, $excludedPathPatterns)
1355+
->setArgument(3, $config['exclude_dotfiles']);
13551356

13561357
$container->getDefinition('asset_mapper.public_assets_path_resolver')
13571358
->setArgument(0, $config['public_prefix']);

Resources/config/asset_mapper.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
abstract_arg('array of asset mapper paths'),
7575
param('kernel.project_dir'),
7676
abstract_arg('array of excluded path patterns'),
77+
abstract_arg('exclude dot files'),
7778
])
7879

7980
->set('asset_mapper.public_assets_path_resolver', PublicAssetsPathResolver::class)

Resources/config/schema/symfony-1.0.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@
196196
<xsd:element name="importmap-script-attribute" type="asset_mapper_attribute" minOccurs="0" maxOccurs="unbounded" />
197197
</xsd:sequence>
198198
<xsd:attribute name="enabled" type="xsd:boolean" />
199+
<xsd:attribute name="exclude-dotfiles" type="xsd:boolean" />
199200
<xsd:attribute name="server" type="xsd:boolean" />
200201
<xsd:attribute name="public-prefix" type="xsd:string" />
201202
<xsd:attribute name="missing-import-mode" type="missing-import-mode" />

Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ public function testAssetMapperCanBeEnabled()
137137
'importmap_polyfill' => 'es-module-shims',
138138
'vendor_dir' => '%kernel.project_dir%/assets/vendor',
139139
'importmap_script_attributes' => [],
140+
'exclude_dotfiles' => true,
140141
];
141142

142143
$this->assertEquals($defaultConfig, $config['asset_mapper']);
@@ -674,6 +675,7 @@ protected static function getBundleDefaultConfig()
674675
'importmap_polyfill' => 'es-module-shims',
675676
'vendor_dir' => '%kernel.project_dir%/assets/vendor',
676677
'importmap_script_attributes' => [],
678+
'exclude_dotfiles' => true,
677679
],
678680
'cache' => [
679681
'pools' => [],

0 commit comments

Comments
 (0)