Skip to content

🧬 Shopify development environment, ready for Online Store 2.0 and Shopify CLI. Using Tailwind and Webpack.

License

Notifications You must be signed in to change notification settings

kevin820125/shopify-trafo

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

⚑️ Shopify Trafo

Shopify development kit with new Shopify CLI released on 2021 Shopify Unite.

Uses Shopify Cli, Tailwindcss, PostCSS and Webpack. Uses Stmux to run watchers in parallel.

The project is still work in progress.

We'd love to hear your feedback, ideas and critiques.

Please feel free to send us an Issue.

Features

  • Uses native Shopify CLI
  • Can be used with Github Integration on Shopify
  • Asset pipeline via webpack and Tailwind CLI*β€”jit mode enabled*.
  • Imports CSS and JS as wildcard, add/remove components without importing
  • CSS nesting enabled via PostCSS
  • Lints Shopify, CSS and JS
  • Easily integrate any theme
  • Easy to monitor grid view on terminal

Roadmap

  • Update Readme for codebase structure explanation
  • Update Readme for installation and usage
  • Migrate Grid View
  • Migrate Webpack
  • Migrate Tailwind CLI
  • Migrate Shopify CLI
  • Migrate Shopify Online Store 2.0

Installation

1. Install Shopify CLI

  • Make sure you have Homebrew installed
  • Open your terminal app
  • Run brew tap shopify/shopify
  • Run brew install shopify-cli
  • After the installation is completed, run shopify version, if this outputs a version number you've successfully installed the CLI.

2. Authenticate Shopify CLI

Make sure you have activated your Staff account for your store <store-name>.myshopify.com.

After you install Shopify CLI, you need to authenticate your CLI instance and connect to the store that you want to work on.

Run:

$ shopify login --store=<store-name>.myshopify.com

When prompted, open the provided accounts.shopify.com URL in a browser. In your browser window, log into the account that's attached to the store that you want to use for development.

3. Clone this theme repo and install dependencies

Clone this repo to your computer.

Install dependencies:

$ yarn install

Usage

Add theme files

You can download (Shopify Dawn) or setup your own theme.

See sections and snippets folders for example usage of .liquid, .css, .js together.

Start environment in development mode

$ yarn dev

Start environment in production mode (minified)

$ yarn production

Build once in development mode

$ yarn build:dev

Build once in production mode

$ yarn build:production

Stop environment (kill stmux terminal grid)

This setup uses stmux for grid view. This helps you see errors for each cli easily.

To kill stmux terminals: Hit CTRL+a combination first, then hit k.

Working on local server

Shopify CLI comes with a local theme server which lets you preview your changes live on your local machine.

After you start in development or production mode, Shopify CLI uploads the theme as a development theme on the store that you're connected to, and gives you an IP address and port to preview changes in real time using the store's data.

The server includes hot reload for CSS & Sections. β€”works only on Google Chrome.

Linting

To lint shopify in terminal:

$ yarn lint:shopify

To lint javascript in terminal:

$ yarn lint:js

To lint css in terminal:

$ yarn lint:css

Command line structure

Project Structure

Folders without _ or . as prefix are the Shopify theme directories.

Webpack

  • auto imports js files from ./_scripts, ./sections and ./snippets
  • for the .js files you want to keep separate, add them directly to ./assets

Entry point:

_scripts/main.js

Output:

assets/index.js

Tailwind CSS

  • auto purges unused classes
  • auto imports scss files from ./_styles, ./sections and ./snippets
  • for the .css files you want to keep separate, add them directly to ./assets

Entry point:

_styles/main.css

Output:

assets/style.css

File Structure

shopify-trafo/                 πŸ“ root of your Shopify Theme Kit project
β”œβ”€β”€ .config/                   πŸ“ development environment files and configs
β”‚   β”œβ”€β”€ webpack/               πŸ“ webpack configs
β”‚   β”‚   β”œβ”€β”€ webpack.common.js  πŸ“„ webpack shared config used in development and production
β”‚   β”‚   β”œβ”€β”€ webpack.dev.js     πŸ“„ webpack development config
β”‚   β”‚   └── webpack.prod.js    πŸ“„ webpack production config
β”‚   β”œβ”€β”€ .browserslistrc        πŸ“„ Browserslist config
β”‚   β”œβ”€β”€ .eslintrc.js           πŸ“„ ESLint config
β”‚   └── .stylelintrc.js        πŸ“„ stylelint config
β”œβ”€β”€ .github/                   πŸ“ files related to GitHub and images for READMEs
β”œβ”€β”€ _scripts/                  πŸ“ source js files to be processed by webpack
β”‚   β”œβ”€β”€ main.js                πŸ“ webpack's main entry point
β”‚   └── ...
β”œβ”€β”€ _styles/                   πŸ“ source css files to be processed by Tailwind CSS
β”‚   β”œβ”€β”€ main.css               πŸ“ Tailwind's main entry point
β”‚   └── ...
β”œβ”€β”€ assets/                    πŸ“ image, font, CSS, and JavaScript files.
β”œβ”€β”€ config/                    πŸ“ theme settings schema and data
β”œβ”€β”€ layout/                    πŸ“ layout files, through which template files are rendered
β”œβ”€β”€ locales/                   πŸ“ translated content
β”œβ”€β”€ sections/                  πŸ“ reusable modules of content that merchants can customize
β”œβ”€β”€ snippets/                  πŸ“ liquid files that host smaller reusable snippets of code
β”œβ”€β”€ templates/                 πŸ“ template files, which control what's rendered on each type of page.
β”œβ”€β”€ .gitignore                 πŸ“„ files and directories ignored by git
β”œβ”€β”€ .shopifyignore             πŸ“„ files and directories ignored by Shopify
β”œβ”€β”€ package.json               πŸ“„ dependencies and tasks
β”œβ”€β”€ postcss.config.js          πŸ“„ PostCSS config
β”œβ”€β”€ tailwind.config.js         πŸ“„ Tailwind CSS config
└── ...

About

🧬 Shopify development environment, ready for Online Store 2.0 and Shopify CLI. Using Tailwind and Webpack.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 90.5%
  • CSS 9.2%
  • Liquid 0.3%