To create a theme or fix a bug on a Shopify environment, it is important to follow the best practices established by Shopify. In the rest of this tutorial, we will cover the essential steps to follow.
Installation of shopify cli.
#install prerequis
sudo apt update && sudo apt upgrade
sudo apt install curl gcc g++ make
sudo apt install git
#install shopify cli
npm install -g @shopify/cli @shopify/themeInstall the version of Ruby suitable for Shopify, use rvm, see this tutorial.
If you have Ruby installed via apt, be sure to uninstall it.
List the versions of Ruby:
rvm list knownResults :
...
[ruby-]2.3[.8]
[ruby-]2.4[.10]
[ruby-]2.5[.8]
[ruby-]2.6[.6]
[ruby-]2.7[.2]
[ruby-]3[.0.0]
...
Install a specific version, for example 3.0.0
rvm install ruby-3.0.0Enable sources generated by rvm ( see ubuntu && debian):
source ~/.rvm/scripts/rvm
type rvm | head -n 1Set the default version:
rvm use --default 3.0.0Verification : ruby --version
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]If you have a version of Shopify CLI, upgrade it.
Log in to a Shopify site:
shopify auth logout && shopify theme list --store [id-boutique].myshopify.comVerify that you are on the correct Shopify domain:
shopify theme infoCreate the folder that will contain the theme files and access it:
shopify theme pull --theme=[id-du-theme]
Some useful commands (see all commands related to themes ):
List themes:
shopify theme list --store={remplace_with_sub_domaine}.myshopify.comFor real-time development:
shopify theme dev