Skip to content

Latest commit

 

History

History
62 lines (45 loc) · 1.86 KB

README_webpack-config.md

File metadata and controls

62 lines (45 loc) · 1.86 KB

BitBag SyliusProductBundlePlugin

Installation - Import Webpack Config


  1. Import plugin's webpack.config.js file
// webpack.config.js
const [bitbagproductBundleShop, bitbagproductBundleAdmin] = require('./vendor/bitbag/product-bundle-plugin/webpack.config.js');
...

module.exports = [..., bitbagproductBundleShop, bitbagproductBundleAdmin];
  1. Add new packages in ./config/packages/assets.yaml
# config/packages/assets.yaml

framework:
    assets:
        packages:
            # ...
            shop:
                json_manifest_path: '%kernel.project_dir%/public/build/shop/manifest.json'
            product_bundle_shop:
                json_manifest_path: '%kernel.project_dir%/public/build/bitbag/productBundle/shop/manifest.json'
            product_bundle_admin:
                json_manifest_path: '%kernel.project_dir%/public/build/bitbag/productBundle/admin/manifest.json'
  1. Add new build paths in ./config/packages/webpack_encore.yml
# config/packages/webpack_encore.yml

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

{# @SyliusShopBundle/_styles.html.twig #}
{{ encore_entry_link_tags('bitbag-productBundle-shop', null, 'product_bundle_shop') }}

{# @SyliusAdminBundle/_scripts.html.twig #}
{{ encore_entry_script_tags('bitbag-productBundle-admin', null, 'product_bundle_admin') }}

{# @SyliusAdminBundle/_styles.html.twig #}
{{ encore_entry_link_tags('bitbag-productBundle-admin', null, 'product_bundle_admin') }}
  1. Run yarn encore dev or yarn encore production