Using Shopware's Watch Scripts

How to use the watch scripts to preview changes without having to recompile everything.

325 views
d

By. Jacob

Edited: 2022-11-06 08:25

1. Go to shopware's root folder:

cd /var/www/shopware/

2. Ron the desired watch- script:

sudo -u www-data bin/watch-storefront.sh

3. Preview your changes on the port number used by the watch script. E.g: http://localhost:8080/

Note. Remember to use the port number the script tells you to, otherwise you will not be able to see any changes. E.g: http://localhost:8080/ instead of http://localhost/.

What are the watch scripts used for?

Shopware has a couple of very useful scripts for developers, which allow us to view our changes "live", without the need to compile everything constantly.

  1. bin/watch-administration.sh
  2. bin/watch-storefront.sh

These scripts will start an extra web server on a separate port, so you should pay attention to the port number mentioned in the terminal when running the scripts. watch-administration.sh is used to test changes in the administration back-end while watch-storefront.sh allows you to test things in the storefront.

The scripts also work on your live server, but you need to make sure the port number used is also opened in your firewall.

You may run one of the scripts by typing:

sudo -u www-data bin/watch-administration.sh

Tell us what you think:

  1. Sometimes we may to manually clear cached Shopware files to fix namespace issues.
  2. How to obtain the currently selected API language from Shopware vue components.
  3. How to access file system paths from storefront twig files in Shopware.
  4. How to get or change the currently selected sales channel in an Shopware sw-sales-channel-switch component.
  5. In this tutorial you will learn how to work with Shopware entities in a generic way from PHP, without having to specifically inject the repository in your services.xml file.

More in: Shopware