Skip to content

Commit

Permalink
Merge pull request #116 from oallain/doc/sylius-12
Browse files Browse the repository at this point in the history
update readme for sylius 1.12
  • Loading branch information
oallain authored Jun 30, 2023
2 parents b78ba7f + ce086c1 commit 7d8366e
Showing 1 changed file with 83 additions and 79 deletions.
162 changes: 83 additions & 79 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,109 +16,113 @@ The instructions below refer to an installation in the theme folder. Installatio
- Sylius 1.7 : `composer require sylius/bootstrap-theme:~0.2.0`
- Sylius 1.8 : `composer require sylius/bootstrap-theme:~0.3.0`
- Sylius 1.8, 1.9 and 1.10 : `composer require sylius/bootstrap-theme:~0.4.0`
- Sylius 1.11 : `composer require sylius/bootstrap-theme:~0.6.0`
- Sylius 1.12 : `composer require sylius/bootstrap-theme:~0.7.0`

Master is compatible with Sylius 1.8, 1.9, 1.10, 1.11, 1.12.
Sylius 1.11 tested with Node v15.14.0, Sylius 1.12 tested with Node v18.16.0
Sylius 1.11 tested with Node v15.14.0, Sylius 1.12 tested with **Node v18**.16.0

1. Copy files from repository to `./themes/BootstrapTheme`

2. For sylius **<1.12** install Encore
Only `assets` and `SyliusShopBundle` directories and the `webpack.config.js` file are required.

```bash
composer require encore
```
2. Install Encore (Only for sylius **<1.12**)

```bash
composer require encore
```

3. Install node dependencies

```bash
yarn
yarn add @symfony/webpack-encore sass-loader@^13.0.0 node-sass -D
yarn add lodash.throttle -D
yarn add bootstrap@^4.5.0 bootstrap.native@^3.0.0 glightbox axios form-serialize @fortawesome/fontawesome-svg-core @fortawesome/free-brands-svg-icons @fortawesome/free-regular-svg-icons @fortawesome/free-solid-svg-icons popper.js
yarn add @popperjs/core
```
```bash
yarn
yarn add @symfony/webpack-encore sass-loader@^13.0.0 node-sass -D
yarn add lodash.throttle -D
yarn add bootstrap@^4.5.0 bootstrap.native@^3.0.0 glightbox axios form-serialize @fortawesome/fontawesome-svg-core @fortawesome/free-brands-svg-icons @fortawesome/free-regular-svg-icons @fortawesome/free-solid-svg-icons popper.js
yarn add @popperjs/core
```

4. Import bootstrap-theme config in the main webpack file

```bash
# ./webpack.config.js
```diff
# ./webpack.config.js

const Encore = require('@symfony/webpack-encore');
const bootstrapTheme = require('./themes/BootstrapTheme/webpack.config');
module.exports = [bootstrapTheme];
```
+ const bootstrapTheme = require('./themes/BootstrapTheme/webpack.config');

- module.exports = [shopConfig, adminConfig, appShopConfig, appAdminConfig];
+ module.exports = [shopConfig, adminConfig, appShopConfig, appAdminConfig, bootstrapTheme];

For sylius **1.11** and **1.12** change output paths
```

For sylius **1.11** and **1.12** change output paths

```bash
# ./webpack.config.js
// Shop config
Encore
.setOutputPath('public/bootstrap-theme')
.setPublicPath('/bootstrap-theme')
```
```diff
# ./webpack.config.js
// Shop config
Encore
- .setOutputPath('public/build/shop/')
- .setPublicPath('/build/shop')
- .addEntry('shop-entry', './vendor/sylius/sylius/src/Sylius/Bundle/ShopBundle/Resources/private/entry.js')
+ .setOutputPath('public/bootstrap-theme')
+ .setPublicPath('/bootstrap-theme')
+ .addEntry('app', './themes/BootstrapTheme/assets/app.js')
.disableSingleRuntimeChunk()
.cleanupOutputBeforeBuild()
.enableSourceMaps(!Encore.isProduction())
.enableVersioning(Encore.isProduction())
.enableSassLoader();
```

5. Edit project config files

```bash
# ./config/packages/assets.yaml
framework:
assets:
packages:
bootstrapTheme:
json_manifest_path: '%kernel.project_dir%/public/bootstrap-theme/manifest.json'
admin:
json_manifest_path: '%kernel.project_dir%/public/build/admin/manifest.json'
shop:
json_manifest_path: '%kernel.project_dir%/public/build/shop/manifest.json'
app.admin:
json_manifest_path: '%kernel.project_dir%/public/build/app/admin/manifest.json'
app.shop:
json_manifest_path: '%kernel.project_dir%/public/build/app/shop/manifest.json'
```
```diff
# ./config/packages/assets.yaml

```bash
# ./config/packages/webpack_encore.yaml
webpack_encore:
output_path: '%kernel.project_dir%/public/build'
builds:
bootstrapTheme: '%kernel.project_dir%/public/bootstrap-theme'
admin: '%kernel.project_dir%/public/build/admin'
shop: '%kernel.project_dir%/public/build/shop'
app.admin: '%kernel.project_dir%/public/build/app/admin'
app.shop: '%kernel.project_dir%/public/build/app/shop'
```

```bash
# ./config/packages/_sylius.yaml
sylius_theme:
legacy_mode: true # for sylius 1.9, 1.10, 1.11, 1.12
```
framework:
assets:
packages:
+ bootstrapTheme:
+ json_manifest_path: '%kernel.project_dir%/public/bootstrap-theme/manifest.json'
```

```diff
# ./config/packages/webpack_encore.yaml

webpack_encore:
output_path: '%kernel.project_dir%/public/build'
builds:
+ bootstrapTheme: '%kernel.project_dir%/public/bootstrap-theme'
```

```diff
# ./config/packages/_sylius.yaml
sylius_theme:
+ legacy_mode: true # for sylius 1.9, 1.10, 1.11, 1.12
```

6. To build the assets, run one of the following commands
```bash
# compile assets once
yarn encore dev
```bash
# compile assets once
yarn encore dev

# recompile assets automatically when files change
yarn encore dev --watch
# recompile assets automatically when files change
yarn encore dev --watch

# recompile assets automatically with live reload
yarn encore dev-server
# recompile assets automatically with live reload
yarn encore dev-server

# create a production build
yarn encore production
```
In Sylius 1.12 you can use predefined commands
```bash
# compile assets once
yarn build
# create a production build
yarn encore production
```

# recompile assets automatically when files change
yarn watch
```
In Sylius 1.12 you can use predefined commands

```bash
# compile assets once
yarn build

# recompile assets automatically when files change
yarn watch
```

7. Change theme in the admin panel by visiting the Edit Channel page

Expand Down

0 comments on commit 7d8366e

Please sign in to comment.