mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-05 20:57:12 +00:00
Merge 35dd531c54 into 9b6799e2b8
This commit is contained in:
commit
1866572d1e
12 changed files with 148 additions and 29 deletions
|
|
@ -62,5 +62,25 @@ SYLIUS_TELEMETRY_SALT=your-custom-salt
|
||||||
## Translations
|
## Translations
|
||||||
|
|
||||||
1. The `TranslationLocaleProvider` now ensures that the default locale (configured as `locale` in `config/parameters.yaml`)
|
1. The `TranslationLocaleProvider` now ensures that the default locale (configured as `locale` in `config/parameters.yaml`)
|
||||||
is always placed at the beginning of the returned locales array.
|
is always placed at the beginning of the returned locales array.
|
||||||
Other locales remain in the same order as returned by the repository.
|
Other locales remain in the same order as returned by the repository.
|
||||||
|
|
||||||
|
## Shop Bootstrap separation
|
||||||
|
|
||||||
|
Bootstrap has been extracted into a separate webpack entry point (`bootstrap-entry`) with dedicated twig hooks:
|
||||||
|
- `sylius_shop.base#stylesheets` > `bootstrap` (priority 100)
|
||||||
|
- `sylius_shop.base#javascripts` > `bootstrap` (priority 100)
|
||||||
|
|
||||||
|
This allows disabling Bootstrap entirely if you want to use a different CSS framework.
|
||||||
|
|
||||||
|
**If you have overridden the `styles` hook** in `sylius_shop.base#stylesheets` and included Bootstrap there, it may now load twice. To fix this, either:
|
||||||
|
- Remove Bootstrap from your custom `styles` hook, or
|
||||||
|
- Disable the new `bootstrap` hook by setting `enabled: false`
|
||||||
|
|
||||||
|
**To disable Bootstrap in webpack**, pass `includeBootstrap: false` to the config:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const shopConfig = SyliusShop.getBaseWebpackConfig(path.resolve(__dirname), {
|
||||||
|
includeBootstrap: false
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
|
||||||
11
src/Sylius/Bundle/ShopBundle/Resources/assets/bootstrap-entry.js
vendored
Normal file
11
src/Sylius/Bundle/ShopBundle/Resources/assets/bootstrap-entry.js
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the Sylius package.
|
||||||
|
*
|
||||||
|
* (c) Sylius Sp. z o.o.
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import './styles/bootstrap.scss';
|
||||||
|
import './scripts/bootstrap';
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
import './styles/main.scss';
|
import './styles/main.scss';
|
||||||
|
|
||||||
import './scripts/bootstrap';
|
|
||||||
import './scripts/spotlight';
|
import './scripts/spotlight';
|
||||||
|
|
||||||
const imagesContext = require.context('./images', true, /\.(jpg|jpeg|png|svg|gif|webp)$/);
|
const imagesContext = require.context('./images', true, /\.(jpg|jpeg|png|svg|gif|webp)$/);
|
||||||
|
|
|
||||||
|
|
@ -21,27 +21,22 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-transparent {
|
.btn-transparent {
|
||||||
@extend .btn-light;
|
--bs-btn-bg: transparent;
|
||||||
background-color: transparent;
|
--bs-btn-border-color: transparent;
|
||||||
border-color: transparent;
|
--bs-btn-hover-bg: #{$gray-100};
|
||||||
|
--bs-btn-hover-border-color: transparent;
|
||||||
&:hover {
|
--bs-btn-active-bg: #{$gray-200};
|
||||||
background-color: $gray-100;
|
--bs-btn-active-border-color: transparent;
|
||||||
border-color: transparent;
|
--bs-btn-focus-shadow-rgb: 0, 0, 0;
|
||||||
}
|
|
||||||
|
|
||||||
&:focus {
|
|
||||||
background-color: transparent !important;
|
|
||||||
border-color: transparent !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:active {
|
|
||||||
background-color: $gray-200 !important;
|
|
||||||
border-color: transparent !important;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-outline-gray {
|
.btn-outline-gray {
|
||||||
@extend .btn-outline-dark;
|
--bs-btn-color: #{$gray-800};
|
||||||
--bs-btn-border-color: var(--bs-gray-400);
|
--bs-btn-border-color: #{$gray-400};
|
||||||
|
--bs-btn-hover-color: #fff;
|
||||||
|
--bs-btn-hover-bg: #{$gray-800};
|
||||||
|
--bs-btn-hover-border-color: #{$gray-800};
|
||||||
|
--bs-btn-active-color: #fff;
|
||||||
|
--bs-btn-active-bg: #{$gray-800};
|
||||||
|
--bs-btn-active-border-color: #{$gray-800};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ $enable-cssgrid: true;
|
||||||
// Color system
|
// Color system
|
||||||
|
|
||||||
$primary: #22B99A;
|
$primary: #22B99A;
|
||||||
|
$danger: #dc3545;
|
||||||
|
|
||||||
$gray-100: #f8f9fa;
|
$gray-100: #f8f9fa;
|
||||||
$gray-200: #e9ecef;
|
$gray-200: #e9ecef;
|
||||||
|
|
@ -25,6 +26,8 @@ $gray-700: #495057;
|
||||||
$gray-800: #343a40;
|
$gray-800: #343a40;
|
||||||
$gray-900: #212529;
|
$gray-900: #212529;
|
||||||
|
|
||||||
|
$link-hover-color: $primary;
|
||||||
|
|
||||||
// Body
|
// Body
|
||||||
|
|
||||||
$body-color: $gray-900;
|
$body-color: $gray-900;
|
||||||
|
|
|
||||||
11
src/Sylius/Bundle/ShopBundle/Resources/assets/styles/bootstrap.scss
vendored
Normal file
11
src/Sylius/Bundle/ShopBundle/Resources/assets/styles/bootstrap.scss
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the Sylius package.
|
||||||
|
*
|
||||||
|
* (c) Sylius Sp. z o.o.
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@import "variables";
|
||||||
|
@import "bootstrap/scss/bootstrap";
|
||||||
|
|
@ -8,11 +8,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@import "variables";
|
@import "variables";
|
||||||
|
@import "mixins/breakpoints";
|
||||||
@import "mixins/text-truncate";
|
@import "mixins/text-truncate";
|
||||||
@import "utils";
|
@import "utils";
|
||||||
|
|
||||||
@import "bootstrap/scss/bootstrap";
|
|
||||||
|
|
||||||
@import "base";
|
@import "base";
|
||||||
@import "accordion";
|
@import "accordion";
|
||||||
@import "buttons";
|
@import "buttons";
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the Sylius package.
|
||||||
|
*
|
||||||
|
* (c) Sylius Sp. z o.o.
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
$grid-breakpoints: (
|
||||||
|
xs: 0,
|
||||||
|
sm: 576px,
|
||||||
|
md: 768px,
|
||||||
|
lg: 992px,
|
||||||
|
xl: 1200px,
|
||||||
|
xxl: 1400px,
|
||||||
|
) !default;
|
||||||
|
|
||||||
|
@function breakpoint-min($name) {
|
||||||
|
$min: map-get($grid-breakpoints, $name);
|
||||||
|
@return if($min != 0, $min, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@function breakpoint-max($name) {
|
||||||
|
$max: map-get($grid-breakpoints, $name);
|
||||||
|
@return if($max and $max > 0, $max - .02, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@mixin media-breakpoint-up($name) {
|
||||||
|
$min: breakpoint-min($name);
|
||||||
|
@if $min {
|
||||||
|
@media (min-width: $min) {
|
||||||
|
@content;
|
||||||
|
}
|
||||||
|
} @else {
|
||||||
|
@content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@mixin media-breakpoint-down($name) {
|
||||||
|
$max: breakpoint-max($name);
|
||||||
|
@if $max {
|
||||||
|
@media (max-width: $max) {
|
||||||
|
@content;
|
||||||
|
}
|
||||||
|
} @else {
|
||||||
|
@content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@mixin media-breakpoint-between($lower, $upper) {
|
||||||
|
$min: breakpoint-min($lower);
|
||||||
|
$max: breakpoint-max($upper);
|
||||||
|
@if $min and $max {
|
||||||
|
@media (min-width: $min) and (max-width: $max) {
|
||||||
|
@content;
|
||||||
|
}
|
||||||
|
} @else if $min {
|
||||||
|
@include media-breakpoint-up($lower) {
|
||||||
|
@content;
|
||||||
|
}
|
||||||
|
} @else if $max {
|
||||||
|
@include media-breakpoint-down($upper) {
|
||||||
|
@content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,18 +4,24 @@ sylius_twig_hooks:
|
||||||
defaults:
|
defaults:
|
||||||
template: '@SyliusShop/shared/layout/base/body_classes/defaults.html.twig'
|
template: '@SyliusShop/shared/layout/base/body_classes/defaults.html.twig'
|
||||||
priority: 0
|
priority: 0
|
||||||
|
|
||||||
'sylius_shop.base#metatags':
|
'sylius_shop.base#metatags':
|
||||||
metatags:
|
metatags:
|
||||||
template: '@SyliusShop/shared/layout/base/metatags.html.twig'
|
template: '@SyliusShop/shared/layout/base/metatags.html.twig'
|
||||||
priority: 0
|
priority: 0
|
||||||
|
|
||||||
'sylius_shop.base#stylesheets':
|
'sylius_shop.base#stylesheets':
|
||||||
|
bootstrap:
|
||||||
|
template: '@SyliusShop/shared/layout/base/styles/bootstrap.html.twig'
|
||||||
|
priority: 100
|
||||||
styles:
|
styles:
|
||||||
template: '@SyliusShop/shared/layout/base/styles.html.twig'
|
template: '@SyliusShop/shared/layout/base/styles.html.twig'
|
||||||
priority: 0
|
priority: 0
|
||||||
|
|
||||||
'sylius_shop.base#javascripts':
|
'sylius_shop.base#javascripts':
|
||||||
|
bootstrap:
|
||||||
|
template: '@SyliusShop/shared/layout/base/scripts/bootstrap.html.twig'
|
||||||
|
priority: 100
|
||||||
scripts:
|
scripts:
|
||||||
template: '@SyliusShop/shared/layout/base/scripts.html.twig'
|
template: '@SyliusShop/shared/layout/base/scripts.html.twig'
|
||||||
priority: 0
|
priority: 0
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,15 @@ class SyliusShop {
|
||||||
* Provide a light Webpack configuration for Sylius Admin
|
* Provide a light Webpack configuration for Sylius Admin
|
||||||
* All the stimulus stuff should be handled by the app.shop entrypoint
|
* All the stimulus stuff should be handled by the app.shop entrypoint
|
||||||
*/
|
*/
|
||||||
static getBaseWebpackConfig(rootDir) {
|
static getBaseWebpackConfig(rootDir, options = {}) {
|
||||||
|
const { includeBootstrap = true } = options;
|
||||||
|
|
||||||
this._prepareWebpackConfig(rootDir);
|
this._prepareWebpackConfig(rootDir);
|
||||||
Encore
|
|
||||||
.addEntry('shop-entry', path.resolve(__dirname, 'Resources/assets/entrypoint.js'));
|
if (includeBootstrap) {
|
||||||
|
Encore.addEntry('bootstrap-entry', path.resolve(__dirname, 'Resources/assets/bootstrap-entry.js'));
|
||||||
|
}
|
||||||
|
Encore.addEntry('shop-entry', path.resolve(__dirname, 'Resources/assets/entrypoint.js'));
|
||||||
|
|
||||||
const shopConfig = Encore.getWebpackConfig();
|
const shopConfig = Encore.getWebpackConfig();
|
||||||
|
|
||||||
|
|
@ -39,6 +44,7 @@ class SyliusShop {
|
||||||
this._prepareWebpackConfig(rootDir);
|
this._prepareWebpackConfig(rootDir);
|
||||||
// For a ready-to-use Stimulus bridge. Should be used only for sylius/sylius tests
|
// For a ready-to-use Stimulus bridge. Should be used only for sylius/sylius tests
|
||||||
Encore
|
Encore
|
||||||
|
.addEntry('bootstrap-entry', path.resolve(__dirname, 'Resources/assets/bootstrap-entry.js'))
|
||||||
.addEntry('shop-entry', path.resolve(__dirname, 'Resources/assets/app.js'))
|
.addEntry('shop-entry', path.resolve(__dirname, 'Resources/assets/app.js'))
|
||||||
.enableStimulusBridge(path.resolve(__dirname, 'Resources/assets/controllers.json'));
|
.enableStimulusBridge(path.resolve(__dirname, 'Resources/assets/controllers.json'));
|
||||||
const shopConfig = Encore.getWebpackConfig();
|
const shopConfig = Encore.getWebpackConfig();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{{ encore_entry_script_tags('bootstrap-entry', null, 'shop') }}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{{ encore_entry_link_tags('bootstrap-entry', null, 'shop') }}
|
||||||
Loading…
Add table
Reference in a new issue