Magento theme
ScandiPWA theme is capable of being bundled into the valid Magento theme. However, in order to do it, the theme must have the @scandipwa/m2-theme
extension installed.
In order to install this extension, run ScandiPWA CLI command from the theme root:
Enabling this extension will allow your ScandiPWA to behave just like the valid Magento 2 theme. If you set the environment variable BUILD_MODE
equal to magento
the behavior of the npm run start
and npm run build
will change.
npm run start
or yarn start
npm run start
or yarn start
This command will now watch the files and put their compiled versions into the magento/Magento_Theme
folder.
npm run build
or yarn build
npm run build
or yarn build
This command will now create the production build of the application in magento/Magento_Theme
folder.
Composer dependencies validation
Additionally, the validation of composer.json
in the theme root will be activated. The extension will make sure the composer packages specified in the scandipwa.composer
filed of your parent themes and extensions package.json
files are reflected in your theme's composer.json
. This is required when connecting to Magento 2 instances.
Deploying from local composer repository
To deploy ScandiPWA as Magento 2 theme, you will need a running Magento 2 instance. Copy your ScandiPWA theme with @scandipwa/m2-theme
extension installed to your Magento 2 server.
Build ScandiPWA into Magento theme using the
npm run build
command withBUILD_MODE
environment variable equal tomagento
. You must do it from the ScandiPWA theme root.From the Magento theme root, add the path to your theme root as a local composer repository. You can use the following command:
composer config repo.theme path <path to scandipwa root>
Now require your theme composer package using the
composer require <composer package name>
. The name of your composer package is defined inname
field of thecomposer.json
file.
Developing from local composer repository
You can also develop ScandiPWA in the Magento theme mode, in order to do that:
Disable Magento 2 full-page cache:
bin/magento cache:disable full_page
Start ScandiPWA in development mode using the
npm run start
command withBUILD_MODE
environment variable equal tomagento
. You must do it from the ScandiPWA theme root.From the Magento theme root, add the path to your theme root as a local composer repository. You can use the following command:
composer config repo.theme path <path to scandipwa root>
Now require your theme composer package using the
composer require <composer package name>
. The name of your composer package is defined inname
field of thecomposer.json
file.
Last updated