Shopify本地编辑Themes主题

1,117 阅读1分钟

Theme Kit

Theme Kit是Shopify主题开发的命令行开发工具,主要功能有:

  1. 上传/下载主题
  2. 监测本地文件更改并上传到shopify

安装

Windows安装

通过chocolatey安装: choco install themekit

Mac安装

使用Homebrew安装: brew install themekit

Linux安装:

curl -s https://shopify.github.io/themekit/scripts/install.py | sudo python

安装完成后,运行theme,显示如下信息则表示安装成功: image.png

链接商店

要连接到商店并且拥有主题的读写权限,首先得创建Private APP,登录Shopify后台:

Shopify管理员 > Apps > 单击Manage private apps > 单击Create a new private app创建应用

下载模板

将需要编辑的主题模板下载到本地环境,首先需要知道对应模板的ID,通过命令或者在shopify后台都可以获取到:

  1. themeKit命令获取:theme get --list -p=Private APP密码 -s=https://you-store.myshopify.com
  2. shopify后台查询:找到对应的主题模板,点击edit code进入: image.png 获取到模板ID后,运行以下命令下载主题:theme get -p=private App的密码 -s=https://you-store.myshopify.com -t=theme-id image.png

编辑模板

将模板下载至本地后,可以编辑代码,运行theme watch。监视本地文件的更改,并自动推送到shopify中 image.png