Skip to content

Instantly share code, notes, and snippets.

@blanklob
Last active July 15, 2022 12:16
Show Gist options
  • Save blanklob/1b45dd7582f15a9a3b203fc8cc5b4603 to your computer and use it in GitHub Desktop.
Save blanklob/1b45dd7582f15a9a3b203fc8cc5b4603 to your computer and use it in GitHub Desktop.
Blank Command Line Utils
# Click the copy button in the right-hand corner.
blank()
{
__V="2.20.0"
__H="
Blanklob utils to work seamlessly with Shopify CLI $__V
USAGE
blank <command> [options]
COMMANDS
login: Login to a specific store within your organization
init: Clones a theme from a Github repository to your local machine to use as the starting point
dev: Uploads the current theme as a development theme and lunch a development server
check: Runs Shopify Theme Check to analyze your theme code for errors
sync: Sync both local and remote development theme settings manually
edit: Open the theme editor for the development theme in the browser
watch: Watches for file changes and build your CSS using Postcss
build: Build and format your CSS files using Postcss (No Bundling)
format: Format theme files using Prettier
help: Print this help message
OPTIONS
login has <store> option from the url <store>.myshopify.com
LEARN MORE
Read the full manual at https://shopify.dev/themes/tools/cli
"
case $1 in
"login")
shopify login --store $2.myshopify.com
echo
;;
"init")
shopify init -u https://github.com/blanklob/$2.git
echo
;;
"dev")
shopify theme serve --theme-editor-sync --port 3000
echo
;;
"watch")
npm run-script env -- postcss assets/input.css -u autoprefixer -o assets/base.css -w
echo
;;
"build")
npm run-script env -- postcss assets/input.css -u autoprefixer cssnano -o assets/base.css && npm run-script env -- prettier --write assets/*.css
echo
;;
"format"
npm run-script env -- prettier --write **/*.{liquid,css,js}
echo
;;
"check")
shopify theme check
echo
;;
"sync")
shopify theme pull -d -n -o 'templates/*.json' 'config/*.json'
echo
;;
"edit")
shopify theme open -d -e
echo
;;
"version")
echo "Shopify CLI $__V"
;;
"help")
echo "$__H"
;;
"")
echo "$__H"
;;
*)
echo ""$1": is not a valid Blank CLI command"
;;
esac
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment