mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
Replace explicit setting a parameters with Symfony's configuration
This commit is contained in:
parent
6370de3a72
commit
5340182461
5 changed files with 21 additions and 11 deletions
|
|
@ -115,16 +115,16 @@ Therefore you need to update your code to follow this change.
|
|||
Example changes we made in our codebase to adjust it to the new version of dependencies might be found [here](https://github.com/Sylius/Sylius/pull/14319/files).
|
||||
Remember, when you face any issues while updating your dependencies you might ask for help in our [Slack](https://sylius-devs.slack.com/) channel.
|
||||
|
||||
#### Webpack becomes our default build tool 🎉
|
||||
#### Webpack becomes our default build tool
|
||||
|
||||
`1.12` comes with a long-awaited change - Webpack becomes our default build tool.
|
||||
|
||||
If you want to stay with Gulp, you can do it by following the steps below:
|
||||
|
||||
1. Go to `config/packages/_sylius.yaml` file and add the following line:
|
||||
```yaml
|
||||
parameters:
|
||||
#...
|
||||
sylius_ui.use_webpack: false
|
||||
sylius_ui:
|
||||
use_webpack: false
|
||||
```
|
||||
|
||||
If you decide to use Webpack, you need to follow the steps below:
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ final class Configuration implements ConfigurationInterface
|
|||
$rootNode
|
||||
->fixXmlConfig('event')
|
||||
->children()
|
||||
->booleanNode('use_webpack')->defaultTrue()->end()
|
||||
->arrayNode('events')
|
||||
->useAttributeAsKey('event_name')
|
||||
->arrayPrototype()
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ namespace Sylius\Bundle\UiBundle\DependencyInjection;
|
|||
use Laminas\Stdlib\SplPriorityQueue;
|
||||
use Sylius\Bundle\UiBundle\Registry\TemplateBlock;
|
||||
use Sylius\Bundle\UiBundle\Registry\TemplateBlockRegistryInterface;
|
||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
|
|
@ -77,7 +78,11 @@ final class SyliusUiExtension extends Extension implements PrependExtensionInter
|
|||
|
||||
public function prepend(ContainerBuilder $container): void
|
||||
{
|
||||
if (true === $container->getParameter('sylius_ui.use_webpack')) {
|
||||
$useWebpack = $this->getCurrentConfiguration($container)['use_webpack'] ?? true;
|
||||
|
||||
$container->setParameter('sylius_ui.use_webpack', $useWebpack);
|
||||
|
||||
if (true === $useWebpack) {
|
||||
$container->prependExtensionConfig('framework', [
|
||||
'assets' => [
|
||||
'packages' => [
|
||||
|
|
@ -92,4 +97,14 @@ final class SyliusUiExtension extends Extension implements PrependExtensionInter
|
|||
]);
|
||||
}
|
||||
}
|
||||
|
||||
private function getCurrentConfiguration(ContainerBuilder $container): array
|
||||
{
|
||||
/** @var ConfigurationInterface $configuration */
|
||||
$configuration = $this->getConfiguration([], $container);
|
||||
|
||||
$configs = $container->getExtensionConfig($this->getAlias());
|
||||
|
||||
return $this->processConfiguration($configuration, $configs);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
imports:
|
||||
- { resource: "@SyliusUiBundle/Resources/config/app/events.yaml" }
|
||||
- { resource: "@SyliusUiBundle/Resources/config/app/parameters.yaml" }
|
||||
|
||||
twig:
|
||||
globals:
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
parameters:
|
||||
sylius_ui.use_webpack: true
|
||||
Loading…
Add table
Reference in a new issue