Skip to content

Latest commit

 

History

History
45 lines (31 loc) · 1.23 KB

01.7-webpack.md

File metadata and controls

45 lines (31 loc) · 1.23 KB

Sylius B2B Kit

Webpack Config

  1. Import plugin's webpack.config.js file
// webpack.config.js
const [syliusB2BKitShop, syliusB2BKitAdmin] = require('./vendor/sylius/b2b-kit/webpack.config');
...

module.exports = [..., syliusB2BKitShop, syliusB2BKitAdmin];
  1. Add new build paths in ./config/packages/webpack_encore.yml
# config/packages/webpack_encore.yml

webpack_encore:
    builds:
        # ...
      sylius-b2b-kit-shop: '%kernel.project_dir%/public/build/sylius/b2b-kit/shop'
      sylius-b2b-kit-admin: '%kernel.project_dir%/public/build/sylius/b2b-kit/admin'
  1. Add encore functions to your templates
{# @SyliusShopBundle/_scripts.html.twig #}
{{ encore_entry_script_tags('sylius-b2b-kit-shop', null, 'sylius-b2b-kit-shop') }}

{# @SyliusShopBundle/_styles.html.twig #}
{{ encore_entry_link_tags('sylius-b2b-kit-shop', null, 'sylius-b2b-kit-shop') }}

{# @SyliusAdminBundle/_scripts.html.twig #}
{{ encore_entry_script_tags('sylius-b2b-kit-admin', null, 'sylius-b2b-kit-admin') }}

{# @SyliusAdminBundle/_styles.html.twig #}
{{ encore_entry_link_tags('sylius-b2b-kit-admin', null, 'sylius-b2b-kit-admin') }}
  1. Run yarn encore dev or yarn encore prod