1. 安装themeKit
参考文档:Getting started with Theme Kit
按装教程参考文档即可,归纳如下:
Windows:
1. 安装 choco 命令行
https://chocolatey.org/install#individual
powershell中执行命令
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
2. 安装themeKit
choco install themekit
Linux:
curl -s https://shopify.dev/themekit.py | sudo python3
macOS:
brew tap shopify/shopify
brew install themekit
2. 如何获取到代码权限,便捷开发
2.1 主题编辑有多种方式可以获取到编辑权限:
- 账号密码(密码暴露不安全)
- 使用【自定义APP】 (官方不推荐)
- 使用【主题访问应用程序】(官方推荐)
2.2 安装【主题访问应用程序】
- 转到Shopify App Store上的Theme Access应用页面。
- 在Theme Access应用程序页面上,单击添加应用程序。
- 在您的 Shopify 后台中,要授权使用该应用,请单击安装应用。
安装该应用后,您可以从Shopify 后台的应用页面查看和使用它。
2.3 具体操作如下图所示:
- 点击创建密码
- 录入开发人员信息,并创建密码,密码会以邮件的形式发送给开发人员
3 使用themeKit进行开发
3.1 在项目目录下创建文件,然后依次填写我们需要的内容信息(下面文件是博主常用的配置项,基本够用)
config.yml:
development:
password: shptka_xxxxxxxx
theme_id: "123456"
store: xxxxxx.myshopify.com
ignore_files:
- '*.gif'
- '*.jpg'
3.2 进入到文件目录, 执行命名,获取项目代码
获取代码:
theme get
3.3 监听文件变动,自动上传更新
非线上发布主题:theme watch
线上发布主题: theme watch --allow-live