Dynamic Multistore - Different assets for the different stores

LukasB
LukasB lukas.bruecklmeier@unic.com Posts: 40 ✨ - Novice

Hello everyone,

we are currently using the dynamic multistore in one of our projects and we have the requirement to apply a slightly different styling to each store.

For simplicity let's say we only want to adjust some scss variables that are currently in the default Theme in the ShopUi folder.

We thought about using code buckets for this, but couldn't find a working solution on how to configure the building of the assets.
So first question: Are code buckets also considered to be used for scss adjustments or is there any other/better way to do this? A theme per store would also work I guess.

And second question, is there any documentation or example to figure out how this need to be configured for the dynamic multistore?

Thanks,

Lukas

Answers

  • Hidran Arias
    Hidran Arias Senior Technical Trainer Sprykee Posts: 110 ⚖️ - Guardians (admin)

    Hi Lukas!

    Code buckets and themes have to be prepared before hand. It means if you create a new store in the backoffice with DMS and that codebucket folder doesn't exist, it won't work.
    The asset building has to be done beforehand.

    You declare your themes bound to each store in
    config/Yves/frontend-build-config.json

    {   
     "codeBucket": "", 
       "namespace": "",  
      "themes": ['green','purple','blue'],  
      "defaultTheme": 
    "default"}
    

    then you add your new themes in ShopUi and run the Yves frontend scripts to generate the new themes.
    npm run yves from the container cli

    Then for every code bucket you'd like to have , you have to create a Twig's config override that returns the theme for that code bucket> for DE codebucket
    src/Pyz/Shared/TwigDE/TwigConfig.php


    and override the getYvesTheme and return the them name to override 'default'.

    Last thing is to override the CodeBucket config to read your store and not the regions in

    src/SprykerConfig/CodeBucketConfig.php

    and ovverrides the codebucket array and getDefaultCodeBucket to get the codebucket, the store code, from the url.

  • LukasB
    LukasB lukas.bruecklmeier@unic.com Posts: 40 ✨ - Novice

    Thanks a lot @Hidran Arias
    I'll try it out and get back to you if something is unclear

  • LukasB
    LukasB lukas.bruecklmeier@unic.com Posts: 40 ✨ - Novice

    @Hidran Arias
    have you had any issues with the container memory limit with multiple themes?
    Do you know if that could be configured?
    We are running into memory issues with the container when we want to build the themes (12 themes in our case):

    image.png
  • Hidran Arias
    Hidran Arias Senior Technical Trainer Sprykee Posts: 110 ⚖️ - Guardians (admin)

    I just ran it on b2b marketplace and no issues. Everything green.
    It could be node memory isn´t enough for the resources you´re adding to the themes such as huge images size?
    Afterwards, I executed:

    export NODE_OPTIONS="--max-old-space-size=4096"

    /usr/bin/time -v node ./frontend/build development in the cli and Got around 6GB of memory usage
    Maximum resident set size (kbytes): 6099440

  • LukasB
    LukasB lukas.bruecklmeier@unic.com Posts: 40 ✨ - Novice

    Thanks a lot for the quick answer!
    I'll try it out