npm create adastra@latest -- --template odestry/adastra/examples/with-lit
Using Yarn/PNPM
yarn create adastra@latest --template odestry/adastra/examples/with-lit
# pnpm create adastra@latest --template odestry/adastra/examples/with-lit
🧑🚀 Hey astronaut? Have fun building Shopify themes with Adastra!
To launch the development server for the first time, you will need to replace the development command inside the package.json
with the following:
"scripts": {
- "dev": "adastra dev",
"dev": "adastra dev -s example-store.myshopify.com",
...
}
💡 The command will launch two dev servers, the first for Vite at
localhost:5173
to server static files from thesrc
directory and the second for Shopify atlocalhost:9292
to serve your theme.
"scripts": {
- "dev": "adastra dev",
"dev": "vite",
"dev:shopify": "shopify theme dev -s example-store.myshopify.com",
"build": "vite build",
...
}
💡 Both commands will launch two dev servers, however you will need to spawn two terminal sessions for each server.
Inside your Adastra ✨ theme project, you'll see the following folders and files.
- Most Shopify themes files and folders remain the same.
- There is only one additional Super Special folder called
src
(you can change its name invite.config.js
file). - Instead of directly editing static assets in the theme
assets
directory, you will use the newsrc
directory instead. - Static files inside the
src
directory are served by Vite. - When launching the developement sever command
npm run dev
the command launches two dev servers, one for Vite to serve static files and the other one for Shopify to upload the development theme to remote Shopify server (Takes a bit of time).
/
├── assets
├── config
├── layout
├── locales
├── sections/
│ └── hello-world.liquid
├── snippets/
│ └── colors.liquid
├── src/ # Source directory (name can be changed in vite.config.js)
│ ├── entrypoints/ # Entrypoints directory (name can be changed in vite.config.js)
│ │ ├── base.css
│ │ └── index.js
│ └── hello-world.js
├── templates
├── vite.config.js
└── package.json
Adastra ✨ detects entrypoint files automatically in the entrypoints/
directory. In this case base.css
for styles and index.js
for modules.
So everything you import to these two files will be shipped to the theme assets
folder when building for production.
You can create other folders like src/utils/
if you want, or a src/components/
folder for Native/React/Vue/Lit/Preact components. Only the files/modules imported in the entrypoint files will be served by Vite.
Any static assets, like custom fonts, manifest files, .css.liquid
or .js.liquid
, can be placed inside the assets
theme folder, just make sure to add the configuration below to avoid clearing the assets directory when building for production.
// vite.config.js
import { defineConfig } from 'vite'
import adastra from 'adastra-plugin'
export default defineConfig({
plugins: [adastra()],
build: {
emptyOutDir: false
}
})
Adastra CLI ✨ is built on top of Shopify CLI 3.X, this means that existing Adastra commands are the same as Shopify's.
adastra dev -s example-store.myshopify.com
# same as shopify theme dev -s example-store.myshopify.com
All commands are run from the root of the theme project, from a terminal:
Command | Action |
---|---|
npm install |
Installs dependencies |
npm run build |
Build and minifies your production static files to ./assets/ folder |
npm run preview |
Preview of your remote development theme, before deploying |
npm run check |
Run theme check to lint the theme |
npm run adastra ... |
Run CLI commands like adastra dev , adastra check |
npm run adastra --help |
Get help using the Adastra CLI |
Feel free to check our documentation or jump into our Discord server.