웹개발/워드프레스 & Shopify

Shopify CLI (download themes from a store / generate a development theme / push )

데브리 2023. 8. 17. 05:38

 

// Homebrew로 쇼피파이 install 하기

brew tap shopify/shopify

 

 

 

// download the CLI and install on local machine

brew install shopify-cli

 

 

 

// 다운로드 되었는지 확인

shopify version

 

 

 

// help

shopify help

 

 

 

// version upgrade

shopify upgrade

 

 

 

// connecting to a store

shopify theme dev --store my-store(본인 스토어 url 스토어.myshopify.com 이거나 스토어.com)

*여기에서 계속 invalid_target 이라고 에러가 나서 확인해봤더니 클라이언트가 처음 만든 스토어 이름과 현재 도메인 이름이 달라서 에러가 발생했던 것. 현재 스토어도메인으로 접속이 안된다면 myshopify.com이 붙은 url로 넣어볼 것.

 

 

 

// store 연결된건지 확인할 때 

shopify theme info 

 

 

 

(데스크탑 바탕화면에 임시 폴더 생성 후 vscode에서 열기)

 

 

 

 

반응형

 

 

// theme pull

shopify theme pull 

*theme이 여러개라면 (live),(unpublished) 등으로 보여지므로 이 중 본인이 선택할 수 있음. 

 

 

 

// 로컬 컴퓨터에 있는 파일들을 수정하면 live로 볼 수 있도록 연결

shopify theme dev (이전에는 shopify theme serve였으나 dev로 바뀜)

* 터미널을 닫을 때 까지 (Ctrl-C) 계속 연동되어 있음.

 

 

 

// 로컬 파일들을 수정 후 push 할 때  

shopify theme push  

* 원래 작업 중이던 theme에 push 할 것!

 

 

 

 

 

* Shopify CLI를 쓰기 위해서는 Theme Access라는 앱을 설치해서 password를 만들고 그 password를 개발자에게 보내면 개발자가 cli를 통해 스토어 접속이 가능함. 

 

 

 

 

theme get으로 받는 법

// connect to a store theme directly (theme get)

theme get -p=패스워드 -s=스토어 주소 --themeid=해당 theme id

 

CLI로 연결해서 theme pull 후 로컬에서 live로 보는 방법이 좋을 것 같아서 해봤는데, 왜인지는 모르겠지만 잘 연결이 안되서 결국 원래 하던 theme get 방법으로 연동함. theme get으로 로컬 파일들을 작업하면 쇼피파이 theme 미리보기에서 바로바로 수정이 되지만 파일이 커서? 무거워서? 랩탑이 금방 뜨거워지고 힘겹게 돌아감;; (하드웨어적인 부분을 몰라서 이런 걸 어떻게 설명하는지는 모르겠지만ㅎㅎㅎ) 게다 가끔 오류도 발생해서 분명 수정하고 저장 다 했는데 그 부분이나 작업한 다른 부분이 날라가있기도 함;;;;;

 

 

 

 

 

 

 

 

* 참고

 

Shopify CLI for themes 

https://shopify.dev/docs/themes/tools/cli#theme-access-password

 

Shopify CLI for themes

Learn about Shopify CLI, a command line tool that helps you to build Shopify themes faster.

shopify.dev

 

 

How to use the Shopify CLI for Building Themes

https://youtu.be/0EUSvAqxFEA