Skip to content

Commit 7954974

Browse files
committed
Merge branch 'master' into alpha
2 parents ae0a99d + 4d59da2 commit 7954974

File tree

72 files changed

+2483
-589
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+2483
-589
lines changed

docs/blog/2019-05-28-hola.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

docs/blog/2019-05-29-hello-world.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

docs/blog/2019-05-30-welcome.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

docs/docs/creating-a-theme.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
---
2+
title: Creating a Theme
3+
---
4+
5+
:::important
6+
7+
If this is your first experience developing Shopify themes, we recommend you to start by reading the basics of Shopify themes development at the [Shopify's Themekit documentation](https://shopify.dev/tools/theme-kit).
8+
9+
:::
10+
11+
## Generating Themes
12+
13+
Generating new themes can be done with the following:
14+
15+
```shell script
16+
$ nx generate @trafilea/nx-shopify:theme <theme-name>
17+
```
18+
19+
This creates the following theme structure:
20+
21+
```treeview
22+
apps
23+
└── my-theme
24+
├── browserslist
25+
├── config.example.yml
26+
├── config.yml
27+
├── package.json
28+
├── postcss.config.js
29+
├── src
30+
│   ├── assets
31+
│   │   ├── favicon
32+
│   │   ├── fonts
33+
│   │   ├── images
34+
│   │   └── svg
35+
│   ├── config
36+
│   │   ├── settings_data.json
37+
│   │   └── settings_schema.json
38+
│   ├── core
39+
│   ├── locales
40+
│   │   └── en.default.json
41+
│   ├── main.ts
42+
│   ├── theme
43+
│   │   ├── layout
44+
│   │   ├── sections
45+
│   │   ├── snippets
46+
│   │   └── templates
47+
│   │   ├── customers
48+
│   └── typings.d.ts
49+
├── tsconfig.app.json
50+
├── tsconfig.json
51+
└── tsconfig.spec.json
52+
```
53+
54+
The main.ts content should look similar to this:
55+
56+
```typescript title="src/main.ts"
57+
__webpack_public_path__ = window['__webpack_public_path__'];
58+
59+
import { themeBootstrapFactory } from '@my-org/my-theme/core/theme-bootstrap';
60+
import { themeLayouts } from '@my-org/my-theme/theme/layout';
61+
import { themeTemplates } from '@my-org/my-theme/theme/templates';
62+
63+
window['themeBootstrap'] = themeBootstrapFactory(themeLayouts, themeTemplates);
64+
```
65+
66+
Note that the `@my-org/my-theme` in the import paths are an alias to the `apps/my-theme/src` path configured in your workspace root `tsconfig.base.json` file.
67+
68+
## Theme Configuration
69+
70+
After generating your theme, the next step is to configure the themekit's `apps/my-theme/config.yml` file.
71+
72+
:::tip
73+
74+
To know more about configuring the themekit's `config.yml` file, see the [Themekit Configuration Reference](https://shopify.dev/tools/theme-kit/configuration-reference).
75+
76+
:::
77+
78+
## Theme Commands
79+
80+
When a Shopify theme is added to the workspace.json, the following targets are available for execution:
81+
82+
### build
83+
84+
```bash
85+
$ nx build <theme-name>
86+
```
87+
88+
The build command will compile the application using Webpack. It supports a production configuration by building with the following command:
89+
90+
```bash
91+
$ nx build <theme-name> --configuration=production
92+
$ nx build <theme-name> -c=production # same
93+
```
94+
95+
Additional configurations can be added in the workspace.json. Changing the --configuration flag with the new configuration name will run that config.
96+
97+
For the specific configuration named `production`, nx provides the following alias:
98+
99+
```bash
100+
$ nx build <theme-name> --prod
101+
```
102+
103+
:::info
104+
105+
Learn more about the build command at the [Build Executor](./executors/build) doc.
106+
107+
:::
108+
109+
### serve
110+
111+
```bash
112+
$ nx serve <theme-name>
113+
```
114+
115+
Builds and servers the theme using a local assets server and a runs a BrowserSync instance that proxies your theme preview.
116+
117+
The serve command will run in watch mode. This allows code to be changed, and the theme will be rebuilt automatically.
118+
119+
Different build configurations can be used when serving a theme, they can be configured in the target options inside the `workspace.json` file or using cli options.
120+
121+
:::info
122+
123+
Learn more about the serve command at the [Serve Executor](./executors/serve) doc.
124+
125+
:::
126+
127+
### deploy
128+
129+
```bash
130+
$ nx deploy <theme-name>
131+
```
132+
133+
Deploys the theme's last build to the themekit environment configured in the `apps/<theme-name>/config.yml` file. It will use the `development` environment by default.
134+
135+
:::info
136+
137+
Learn more about the deploy command at the [Deploy Executor](./executors/deploy) doc.
138+
139+
:::

docs/docs/doc2.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

docs/docs/doc3.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)