vite-plugin-shopify-easel 0.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +158 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +1363 -0
- package/dist/index.js.map +1 -0
- package/package.json +75 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Easel
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Easel
|
|
2
|
+
|
|
3
|
+
Easel is a Vite plugin for Shopify Liquid themes.
|
|
4
|
+
|
|
5
|
+
It builds JavaScript, TypeScript, and CSS into Shopify theme assets, generates the Liquid snippet that loads them, and safely replaces old build output. During development, it can coordinate Vite updates with Shopify CLI reloads. Shopify CLI still handles previews, syncing, and deployment.
|
|
6
|
+
|
|
7
|
+
[Read the documentation](https://easel.billynoyes.co.uk/docs/)
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
pnpm add -D vite-plugin-shopify-easel vite
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Easel requires Node.js 22.12 or newer and supports Vite 7 and 8.
|
|
16
|
+
|
|
17
|
+
## Start
|
|
18
|
+
|
|
19
|
+
Keep the Shopify theme at the project root and place source files in `src`.
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
assets/
|
|
23
|
+
config/
|
|
24
|
+
layout/
|
|
25
|
+
sections/
|
|
26
|
+
snippets/
|
|
27
|
+
templates/
|
|
28
|
+
src/
|
|
29
|
+
main.ts
|
|
30
|
+
style.css
|
|
31
|
+
vite.config.ts
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`src/main.js` also works.
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import {defineConfig} from 'vite';
|
|
38
|
+
import easel from 'vite-plugin-shopify-easel';
|
|
39
|
+
|
|
40
|
+
export default defineConfig({
|
|
41
|
+
plugins: [easel()],
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Render the generated loader in `layout/theme.liquid`.
|
|
46
|
+
|
|
47
|
+
```liquid
|
|
48
|
+
{% render 'easel-assets' %}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Ignore generated output.
|
|
52
|
+
|
|
53
|
+
```gitignore
|
|
54
|
+
.easel/
|
|
55
|
+
assets/easel-*
|
|
56
|
+
snippets/easel-assets.liquid
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Run Vite and Shopify CLI in separate terminals.
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
npm run dev
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
shopify theme dev --notify .easel/shopify-ready
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The notification is optional. Vite HMR and Shopify CLI live reload still work without it.
|
|
70
|
+
|
|
71
|
+
Build before pushing or packaging.
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
npm run build
|
|
75
|
+
shopify theme push
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Named bundles
|
|
79
|
+
|
|
80
|
+
Load only the code each Liquid surface needs.
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
import {defineConfig} from 'vite';
|
|
84
|
+
import easel from 'vite-plugin-shopify-easel';
|
|
85
|
+
|
|
86
|
+
export default defineConfig({
|
|
87
|
+
plugins: [
|
|
88
|
+
easel({
|
|
89
|
+
bundles: {
|
|
90
|
+
theme: {script: 'main.ts', style: 'style.css'},
|
|
91
|
+
product: {script: 'product.ts', style: 'product.css'},
|
|
92
|
+
typography: {style: 'typography.css'},
|
|
93
|
+
},
|
|
94
|
+
}),
|
|
95
|
+
],
|
|
96
|
+
});
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
```liquid
|
|
100
|
+
{% render 'easel-assets', entry: 'product' %}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Bundle paths resolve from `src` by default. The first bundle is used when `entry` is omitted.
|
|
104
|
+
|
|
105
|
+
## Configuration
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
easel({
|
|
109
|
+
// Shopify theme directory relative to the Vite root. Defaults to the Vite root.
|
|
110
|
+
theme: '.',
|
|
111
|
+
|
|
112
|
+
// Source directory relative to the Vite root. Defaults to src.
|
|
113
|
+
source: 'src',
|
|
114
|
+
|
|
115
|
+
// Named entries relative to source. Defaults to main.ts or main.js with style.css.
|
|
116
|
+
bundles: {
|
|
117
|
+
theme: {script: 'main.ts', style: 'style.css'},
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
// Namespace used by generated assets and the Liquid snippet. Defaults to easel.
|
|
121
|
+
namespace: 'easel',
|
|
122
|
+
|
|
123
|
+
// Shopify CLI reload coordination. Use false to disable it.
|
|
124
|
+
refresh: {
|
|
125
|
+
// Notification file relative to the Vite root.
|
|
126
|
+
signal: '.easel/shopify-ready',
|
|
127
|
+
|
|
128
|
+
// Reload debounce in milliseconds. Defaults to 100.
|
|
129
|
+
delay: 100,
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Use Tailwind CSS, Alpine.js, React, Vue, Sass, PostCSS, and other tools through their normal Vite setup. React Fast Refresh requires `@vitejs/plugin-react/preamble` because Easel does not use an HTML entry.
|
|
135
|
+
|
|
136
|
+
## Safe by default
|
|
137
|
+
|
|
138
|
+
Easel never empties Shopify's shared `assets` directory. It tracks only its own files, refuses unsafe overwrites, stages builds in isolation, serializes publication, and rolls back interrupted commits.
|
|
139
|
+
|
|
140
|
+
Production entries keep stable names. Shared chunks, dynamic chunks, imported CSS, images, fonts, and source maps retain Vite's cache safe output behavior.
|
|
141
|
+
|
|
142
|
+
Shopify CLI remains responsible for authentication, previews, synchronization, pushes, and packaging.
|
|
143
|
+
|
|
144
|
+
## Examples
|
|
145
|
+
|
|
146
|
+
• [`examples/vanilla`](examples/vanilla) for TypeScript and CSS
|
|
147
|
+
|
|
148
|
+
• [`examples/alpine-tailwind`](examples/alpine-tailwind) for Alpine.js and Tailwind CSS
|
|
149
|
+
|
|
150
|
+
• [`examples/react`](examples/react) for React inside Liquid sections
|
|
151
|
+
|
|
152
|
+
• [`examples/vue`](examples/vue) for Vue single file components inside Liquid sections
|
|
153
|
+
|
|
154
|
+
Each example includes Shopify Theme Editor lifecycle handling, passes CI, and has been tested against a real Shopify development store.
|
|
155
|
+
|
|
156
|
+
## License
|
|
157
|
+
|
|
158
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
|
|
3
|
+
interface EaselBundle {
|
|
4
|
+
script?: string;
|
|
5
|
+
style?: string;
|
|
6
|
+
}
|
|
7
|
+
interface EaselRefreshOptions {
|
|
8
|
+
/** Shopify CLI --notify file relative to Vite's root. */
|
|
9
|
+
signal?: string;
|
|
10
|
+
/** Delay used to combine repeated Shopify CLI notifications. */
|
|
11
|
+
delay?: number;
|
|
12
|
+
}
|
|
13
|
+
interface EaselOptions {
|
|
14
|
+
/** Shopify theme path relative to Vite's root. Defaults to the Vite root. */
|
|
15
|
+
theme?: string;
|
|
16
|
+
/** Source path relative to Vite's root. Defaults to "src". */
|
|
17
|
+
source?: string;
|
|
18
|
+
/** Named storefront bundles. Defaults to src/main.ts or src/main.js plus src/style.css. */
|
|
19
|
+
bundles?: Record<string, EaselBundle>;
|
|
20
|
+
/** Namespace used for generated assets and the Liquid loader. Defaults to "easel". */
|
|
21
|
+
namespace?: string;
|
|
22
|
+
/** Shopify-aware full-page refresh. Enabled by default. */
|
|
23
|
+
refresh?: boolean | EaselRefreshOptions;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare function easel(options?: EaselOptions): Plugin[];
|
|
27
|
+
|
|
28
|
+
export { type EaselBundle, type EaselOptions, type EaselRefreshOptions, easel as default, easel };
|