@storyblok/svelte 5.2.0 → 5.2.3
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/README.md +47 -357
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,388 +1,78 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
<h1 align="center">@storyblok/svelte</h1>
|
|
6
|
+
<p>
|
|
7
|
+
The Svelte SDK to interact with <a href="http://www.storyblok.com?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte" target="_blank">Storyblok API</a> and enable the <a href="https://www.storyblok.com/docs/guide/essentials/visual-editor?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte" target="_blank">Real-time Visual Editing Experience</a>.
|
|
8
8
|
</p>
|
|
9
9
|
<br />
|
|
10
10
|
</div>
|
|
11
11
|
|
|
12
12
|
<p align="center">
|
|
13
|
-
<a href="https://
|
|
14
|
-
|
|
15
|
-
</
|
|
16
|
-
|
|
17
|
-
<
|
|
18
|
-
|
|
13
|
+
<a href="https://npmjs.com/package/@storyblok/svelte">
|
|
14
|
+
<img src="https://img.shields.io/npm/v/@storyblok/svelte/latest.svg?style=flat-square&color=8d60ff" alt="Storyblok Svelte SDK" />
|
|
15
|
+
</a>
|
|
16
|
+
<a href="https://npmjs.com/package/@storyblok/svelte" rel="nofollow">
|
|
17
|
+
<img src="https://img.shields.io/npm/dt/@storyblok/svelte.svg?style=appveyor&color=8d60ff" alt="npm">
|
|
18
|
+
</a>
|
|
19
|
+
<a href="https://storyblok.com/join-discord">
|
|
20
|
+
<img src="https://img.shields.io/discord/700316478792138842?label=Join%20Our%20Discord%20Community&style=appveyor&logo=discord&color=8d60ff">
|
|
21
|
+
</a>
|
|
19
22
|
<a href="https://twitter.com/intent/follow?screen_name=storyblok">
|
|
20
23
|
<img src="https://img.shields.io/badge/Follow-%40storyblok-8d60ff?style=appveyor&logo=twitter" alt="Follow @Storyblok" />
|
|
24
|
+
</a><br/>
|
|
25
|
+
<a href="https://app.storyblok.com/#!/signup?utm_source=github.com&utm_medium=readme&utm_campaign=@storyblok/svelte">
|
|
26
|
+
<img src="https://img.shields.io/badge/Try%20Storyblok-Free-8d60ff?style=appveyor&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAABGdBTUEAALGPC/xhBQAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAHqADAAQAAAABAAAAHgAAAADpiRU/AAACRElEQVRIDWNgGGmAEd3D3Js3LPrP8D8WXZwSPiMjw6qvPoHhyGYwIXNAbGpbCjbzP0MYuj0YFqMroBV/wCxmIeSju64eDNzMBJUxvP/9i2Hnq5cM1devMnz984eQsQwETeRhYWHgIcJiXqC6VHlFBjUeXgav40cIWkz1oLYXFmGwFBImaDFBHyObcOzdW4aSq5eRhRiE2dgYlpuYoYSKJi8vw3GgWnyAJIs/AuPu4scPGObd/fqVQZ+PHy7+6udPOBsXgySLDfn5GRYYmaKYJcXBgWLpsx8/GPa8foWiBhuHJIsl2DkYQqWksZkDFgP5PObcKYYff//iVAOTIDlx/QPqRMb/YSYBaWlOToZIaVkGZmAZSQiQ5OPtwHwacuo4iplMQEu6tXUZMhSUGDiYmBjylFQYvv/7x9B04xqKOnQOyT5GN+Df//8M59ASXKyMHLoyDD5JPtbj42OYrm+EYgg70JfuYuIoYmLs7AwMjIzA+uY/zjAnyWJpDk6GOFnCvrn86SOwmsNtKciVFAc1ileBHFDC67lzG10Yg0+SjzF0ownsf/OaofvOLYaDQJoQIGix94ljv1gIZI8Pv38zPvj2lQWYf3HGKbpDCFp85v07NnRN1OBTPY6JdRSGxcCw2k6sZuLVMZ5AV4s1TozPnGGFKbz+/PE7IJsHmC//MDMyhXBw8e6FyRFLv3Z0/IKuFqvFyIqAzd1PwBzJw8jAGPfVx38JshwlbIygxmYY43/GQmpais0ODDHuzevLMARHBcgIAQAbOJHZW0/EyQAAAABJRU5ErkJggg==" alt="Follow @Storyblok" />
|
|
21
27
|
</a>
|
|
22
28
|
</p>
|
|
23
|
-
<p align="center">
|
|
24
|
-
<a href="https://app.storyblok.com/#!/signup?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte">
|
|
25
|
-
<img src="https://img.shields.io/badge/Try%20Storyblok-Free-8d60ff?style=appveyor&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAABGdBTUEAALGPC/xhBQAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAHqADAAQAAAABAAAAHgAAAADpiRU/AAACRElEQVRIDWNgGGmAEd3D3Js3LPrP8D8WXZwSPiMjw6qvPoHhyGYwIXNAbGpbCjbzP0MYuj0YFqMroBV/wCxmIeSju64eDNzMBJUxvP/9i2Hnq5cM1devMnz984eQsQwETeRhYWHgIcJiXqC6VHlFBjUeXgav40cIWkz1oLYXFmGwFBImaDFBHyObcOzdW4aSq5eRhRiE2dgYlpuYoYSKJi8vw3GgWnyAJIs/AuPu4scPGObd/fqVQZ+PHy7+6udPOBsXgySLDfn5GRYYmaKYJcXBgWLpsx8/GPa8foWiBhuHJIsl2DkYQqWksZkDFgP5PObcKYYff//iVAOTIDlx/QPqRMb/YSYBaWlOToZIaVkGZmAZSQiQ5OPtwHwacuo4iplMQEu6tXUZMhSUGDiYmBjylFQYvv/7x9B04xqKOnQOyT5GN+Df//8M59ASXKyMHLoyDD5JPtbj42OYrm+EYgg70JfuYuIoYmLs7AwMjIzA+uY/zjAnyWJpDk6GOFnCvrn86SOwmsNtKciVFAc1ileBHFDC67lzG10Yg0+SjzF0ownsf/OaofvOLYaDQJoQIGix94ljv1gIZI8Pv38zPvj2lQWYf3HGKbpDCFp85v07NnRN1OBTPY6JdRSGxcCw2k6sZuLVMZ5AV4s1TozPnGGFKbz+/PE7IJsHmC//MDMyhXBw8e6FyRFLv3Z0/IKuFqvFyIqAzd1PwBzJw8jAGPfVx38JshwlbIygxmYY43/GQmpais0ODDHuzevLMARHBcgIAQAbOJHZW0/EyQAAAABJRU5ErkJggg==" alt="Try @Storyblok" />
|
|
26
|
-
</a>
|
|
27
|
-
</p>
|
|
28
|
-
|
|
29
|
-
## Kickstart a new project
|
|
30
|
-
Are you eager to dive into coding? **[Follow these steps to kickstart a new project with Storyblok and Svelte](https://www.storyblok.com/technologies?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte#sveltekit)**, and get started in just a few minutes!
|
|
31
|
-
|
|
32
|
-
## Ultimate Tutorial
|
|
33
|
-
Are you looking for a hands-on, step-by-step tutorial? The **[SvelteKit Ultimate Tutorial](https://www.storyblok.com/tp/the-storyblok-sveltekit-ultimate-tutorial?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte)** has you covered! It provides comprehensive instructions on building a complete, multilingual website using Storyblok and SvelteKit from start to finish.
|
|
34
|
-
|
|
35
|
-
## Compatibility
|
|
36
|
-
|
|
37
|
-
| Version to install | Support |
|
|
38
|
-
| --------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
|
|
39
|
-
| Latest (from v3) `@storyblok/svelte` | Modern browsers + Node 18+ (Compatible with Svelte 5) |
|
|
40
|
-
| Latest (from v3) `@storyblok/svelte` <br> + Fetch polyfill like [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch) | Browsers and Node versions with no Fetch API support |
|
|
41
|
-
| [Version 2](https://github.com/storyblok/@storyblok/svelte/tree/v2.5.0) `@storyblok/svelte@2` | Internet Explorer support |
|
|
42
|
-
|
|
43
|
-
### Upgrading to Svelte 5
|
|
44
|
-
|
|
45
|
-
We recommend upgrading to Svelte 5 for the latest features and improvements. The latest version of `@storyblok/svelte` is fully compatible with Svelte 5.
|
|
46
|
-
|
|
47
|
-
If you're migrating from Svelte 3/4 to Svelte 5, please follow the [official Svelte migration guide](https://svelte.dev/docs/svelte/v5-migration-guide) and then ensure you're using the latest version of `@storyblok/svelte`.
|
|
48
|
-
|
|
49
|
-
## Usage
|
|
50
|
-
|
|
51
|
-
`@storyblok/svelte` helps you connect your Svelte project to Storyblok by:
|
|
52
|
-
|
|
53
|
-
- Providing the `getStoryblokApi` function to interact with the Storyblok APIs, using the [storyblok-js-client](https://github.com/storyblok/storyblok-js-client);
|
|
54
|
-
- Enabling real-time editing through the [Storyblok Bridge](https://www.storyblok.com/docs/Guides/storyblok-latest-js?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte);
|
|
55
|
-
- Providing the `StoryblokComponent`, which allows you to connect your components to the [Storyblok Visual Editor](https://www.storyblok.com/docs/editor-guides/visual-editor?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte).
|
|
56
|
-
|
|
57
|
-
### Installation
|
|
58
|
-
|
|
59
|
-
Install `@storyblok/svelte`
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
npm install @storyblok/svelte
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
Initialize the library in your application by adding the `apiPlugin` and the [access token](https://www.storyblok.com/docs/api/content-delivery/v2?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte) of your Storyblok space:
|
|
66
|
-
|
|
67
|
-
```js
|
|
68
|
-
import App from './App.svelte';
|
|
69
|
-
import { apiPlugin, storyblokInit } from '@storyblok/svelte';
|
|
70
|
-
|
|
71
|
-
storyblokInit({
|
|
72
|
-
accessToken: '<your-token>',
|
|
73
|
-
// bridge: false,
|
|
74
|
-
use: [apiPlugin],
|
|
75
|
-
|
|
76
|
-
components: {
|
|
77
|
-
teaser: Teaser,
|
|
78
|
-
},
|
|
79
|
-
});
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
The best place to initialize the Storyblok library is in the `main.(ts|js).` or `main.(ts|js)` file if you are using `svelte` or in the `load()` function in the `src/routes/+layout.(ts|js)` file if you are using `SvelteKit`.
|
|
83
|
-
|
|
84
|
-
You can find a good example with SvelteKit in the `playground` folder.
|
|
85
|
-
|
|
86
|
-
List all your components to the components object in the storyblokInit function. You can load all of them by adding them to the list.
|
|
87
|
-
|
|
88
|
-
#### Region parameter
|
|
89
|
-
|
|
90
|
-
Possible values:
|
|
91
|
-
|
|
92
|
-
- `eu` (default): For spaces created in the EU
|
|
93
|
-
- `us`: For spaces created in the US
|
|
94
|
-
- `ap`: For spaces created in Australia
|
|
95
|
-
- `ca`: For spaces created in Canada
|
|
96
|
-
- `cn`: For spaces created in China
|
|
97
|
-
|
|
98
|
-
Full example for a space created in the US:
|
|
99
|
-
|
|
100
|
-
```js
|
|
101
|
-
{
|
|
102
|
-
accessToken: "<your-access-token>",
|
|
103
|
-
apiOptions: {
|
|
104
|
-
region: "us"
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
> **Note**
|
|
110
|
-
> For spaces created in the United States or China, the `region` parameter **must** be specified.
|
|
111
|
-
|
|
112
|
-
## Getting started
|
|
113
|
-
|
|
114
|
-
### 1. Fetching Content
|
|
115
|
-
|
|
116
|
-
Use the `getStoryblokApi`()` to get your stories from the Storyblok CDN API:
|
|
117
|
-
|
|
118
|
-
```html
|
|
119
|
-
<script>
|
|
120
|
-
import { onMount } from 'svelte';
|
|
121
|
-
import { getStoryblokApi } from '@storyblok/svelte';
|
|
122
|
-
onMount(async () => {
|
|
123
|
-
const storyblokApi = getStoryblokApi();
|
|
124
|
-
const { data } = await storyblokApi.get('cdn/stories/home', {
|
|
125
|
-
version: 'draft',
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
</script>
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
> **Note**
|
|
132
|
-
> You can skip using `storyblokApi` if you prefer your own method or function to fetch your data.
|
|
133
|
-
|
|
134
|
-
### 2. Listen to Storyblok Visual Editor events
|
|
135
|
-
|
|
136
|
-
Use `useStoryBridge` to get the updated story every time a change event is triggered from the Visual Editor. You need to pass the story id as the first param, and a callback function as the second param to update the new story:
|
|
137
|
-
|
|
138
|
-
```html
|
|
139
|
-
<script>
|
|
140
|
-
import { onMount } from 'svelte';
|
|
141
|
-
import { getStoryblokApi, useStoryblokBridge } from '@storyblok/svelte';
|
|
142
|
-
let story = null;
|
|
143
|
-
onMount(async () => {
|
|
144
|
-
const storyblokApi = getStoryblokApi();
|
|
145
|
-
const { data } = await storyblokApi.get('cdn/stories/home', {
|
|
146
|
-
version: 'draft',
|
|
147
|
-
});
|
|
148
|
-
story = data.story;
|
|
149
|
-
useStoryblokBridge(story.id, (newStory) => (story = newStory));
|
|
150
|
-
});
|
|
151
|
-
</script>
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
You can pass [Bridge options](https://www.storyblok.com/docs/Guides/storyblok-latest-js?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte) as a third parameter as well:
|
|
155
29
|
|
|
156
|
-
|
|
157
|
-
useStoryblokBridge(story.id, newStory => (story = newStory), {
|
|
158
|
-
resolveRelations: ['Article.author'],
|
|
159
|
-
resolveLinks: 'url',
|
|
160
|
-
});
|
|
161
|
-
```
|
|
30
|
+
## Features
|
|
162
31
|
|
|
163
|
-
|
|
32
|
+
- Fetch content from the Content Delivery API
|
|
33
|
+
- Connect frontend components with the Visual Editor via StoryblokBridge
|
|
34
|
+
- Render rich text content with the Storyblok Rich Text Renderer based on `@storyblok/richtext`
|
|
35
|
+
- Svelte-specific components: `StoryblokComponent` for dynamic component rendering
|
|
36
|
+
- Svelte actions: `storyblokEditable` for Visual Editor integration
|
|
37
|
+
- Svelte 5 compatibility with modern syntax and runes
|
|
38
|
+
- Built-in TypeScript support with comprehensive type definitions
|
|
39
|
+
- SSR/SSG compatibility for SvelteKit applications
|
|
40
|
+
- Rich text rendering with custom schema and component resolvers
|
|
164
41
|
|
|
165
|
-
|
|
42
|
+
## Documentation
|
|
166
43
|
|
|
167
|
-
|
|
44
|
+
For complete documentation, please visit [package reference](https://www.storyblok.com/docs/packages/storyblok-svelte)
|
|
168
45
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
```html
|
|
172
|
-
<div use:storyblokEditable={blok} / >
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
- Use the `StoryblokComponent` to load them by passing the `blok` property
|
|
176
|
-
|
|
177
|
-
```html
|
|
178
|
-
<StoryblokComponent blok={blok} />
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
> The `blok` is the actual blok data coming from [Storyblok's Content Delivery API](https://www.storyblok.com/docs/api/content-delivery/v2?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte).
|
|
182
|
-
|
|
183
|
-
### Features and API
|
|
184
|
-
|
|
185
|
-
You can **choose the features to use** when you initialize the plugin. In that way, you can improve web performance by optimizing your page load and saving some bytes.
|
|
186
|
-
|
|
187
|
-
#### Storyblok API
|
|
188
|
-
|
|
189
|
-
You can use an `apiOptions` object. This is passed down to the [storyblok-js-client config object](https://github.com/storyblok/storyblok-js-client#class-storyblok):
|
|
190
|
-
|
|
191
|
-
```js
|
|
192
|
-
storyblokInit({
|
|
193
|
-
accessToken: '<your-token>',
|
|
194
|
-
apiOptions: {
|
|
195
|
-
// storyblok-js-client config object
|
|
196
|
-
cache: { type: 'memory' },
|
|
197
|
-
},
|
|
198
|
-
use: [apiPlugin],
|
|
199
|
-
});
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
If you prefer to use your own fetch method, just remove the `apiPlugin` and `storyblok-js-client` won't be added to your application. You can find out more about our [Content Delivery API](https://www.storyblok.com/docs/api/content-delivery?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte) in the documentation.
|
|
203
|
-
|
|
204
|
-
#### Storyblok Bridge
|
|
205
|
-
|
|
206
|
-
You can conditionally load it by using the `bridge` option. Very useful if you want to disable it in production:
|
|
207
|
-
|
|
208
|
-
```js
|
|
209
|
-
storyblokInit({
|
|
210
|
-
bridge: process.env.NODE_ENV !== 'production',
|
|
211
|
-
});
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
Keep in mind you have still access to the raw `window.StoryblokBridge`:
|
|
215
|
-
|
|
216
|
-
```js
|
|
217
|
-
const sbBridge = new window.StoryblokBridge(options);
|
|
218
|
-
sbBridge.on(['input', 'published', 'change'], (event) => {
|
|
219
|
-
// ...
|
|
220
|
-
});
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
For background information on the [Storyblok JS Bridge](https://www.storyblok.com/docs/Guides/storyblok-latest-js?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte), please check out the documentation.
|
|
224
|
-
|
|
225
|
-
### Rendering Rich Text
|
|
226
|
-
|
|
227
|
-
You can easily render rich text by using the `renderRichText` function that comes with `@storyblok/svelte` and Svelte `{@html htmlstring}` directive.
|
|
228
|
-
|
|
229
|
-
```html
|
|
230
|
-
<script>
|
|
231
|
-
import { renderRichText } from '@storyblok/svelte';
|
|
232
|
-
|
|
233
|
-
let articleHTML = $derived(renderRichText(blok.article));
|
|
234
|
-
|
|
235
|
-
export let blok;
|
|
236
|
-
</script>
|
|
237
|
-
|
|
238
|
-
<div class="prose">{@html articleHTML}</div>
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
If you are allowing the content editors to add Blok (components like teaser, hero etc) into the rich text editor, you can also implement a specific logic for rendering correctly the components added to the rich text editor.
|
|
242
|
-
To achieve this, you have to obtain the schema definition from the RichTextSchema via cloning object. For cloning schema you can use the clone-deep library for example:
|
|
243
|
-
|
|
244
|
-
```
|
|
245
|
-
npm i clone-deep
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
You can set a **custom Schema and component resolver globally** at init time by using the `richText` init option:
|
|
249
|
-
|
|
250
|
-
```js
|
|
251
|
-
import { RichTextSchema, storyblokInit } from '@storyblok/svelte';
|
|
252
|
-
import cloneDeep from 'clone-deep';
|
|
253
|
-
const mySchema = cloneDeep(RichTextSchema); // you can make a copy of the default RichTextSchema
|
|
254
|
-
// ... and edit the nodes and marks, or add your own.
|
|
255
|
-
// Check the base RichTextSchema source here https://github.com/storyblok/storyblok-js-client/blob/master/source/schema.js
|
|
256
|
-
storyblokInit({
|
|
257
|
-
accessToken: '<your-token>',
|
|
258
|
-
richText: {
|
|
259
|
-
schema: mySchema,
|
|
260
|
-
resolver: (component, blok) => {
|
|
261
|
-
switch (component) {
|
|
262
|
-
case 'my-custom-component':
|
|
263
|
-
return `<div class="my-component-class">${blok.text}</div>`;
|
|
264
|
-
default:
|
|
265
|
-
return 'Resolver not defined';
|
|
266
|
-
}
|
|
267
|
-
},
|
|
268
|
-
},
|
|
269
|
-
});
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
You can also set a **custom Schema and component resolver only once** by passing the options as the second parameter to `renderRichText` function:
|
|
273
|
-
|
|
274
|
-
```js
|
|
275
|
-
<script>
|
|
276
|
-
import {
|
|
277
|
-
RichTextSchema,
|
|
278
|
-
storyblokEditable,
|
|
279
|
-
StoryblokComponent,
|
|
280
|
-
renderRichText,
|
|
281
|
-
} from "@storyblok/svelte";
|
|
282
|
-
import cloneDeep from "clone-deep";
|
|
283
|
-
const mySchema = cloneDeep(RichTextSchema);
|
|
284
|
-
export let blok;
|
|
285
|
-
$: resolvedRichText = renderRichText(blok.richText, {
|
|
286
|
-
schema: mySchema,
|
|
287
|
-
resolver: (component, blok) => {
|
|
288
|
-
switch (component) {
|
|
289
|
-
case "teaser":
|
|
290
|
-
console.log(blok); // for learning purpose
|
|
291
|
-
return `<div class="my-component-class">${blok.headline}</div>`;
|
|
292
|
-
break;
|
|
293
|
-
default:
|
|
294
|
-
return `Component ${component} not found`;
|
|
295
|
-
}
|
|
296
|
-
},
|
|
297
|
-
});
|
|
298
|
-
</script>
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
### Enabling SSL
|
|
302
|
-
|
|
303
|
-
For security reasons the Storyblok UI loads and embeds the frontend project that you are building with Svelte, via HTTPS protocol into Storyblok Visual Editor.
|
|
304
|
-
|
|
305
|
-
To enable the HTTPS protocol when you run `npm run dev`, you can install the `basicSsl` Vite plugin.
|
|
306
|
-
|
|
307
|
-
```
|
|
308
|
-
npm i @vitejs/plugin-basic-ssl
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
and, in the `vite.config.js` file be sure to load correctly the plugin, importing the plugin:
|
|
312
|
-
|
|
313
|
-
```
|
|
314
|
-
import basicSsl from '@vitejs/plugin-basic-ssl'
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
and then, activating the plugin in `plugins` configuration array:
|
|
318
|
-
|
|
319
|
-
```
|
|
320
|
-
plugins: [sveltekit(), basicSsl()],
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
### Compatibility
|
|
324
|
-
|
|
325
|
-
This plugin was made and tested with Svelte 5.
|
|
326
|
-
|
|
327
|
-
## Troubleshooting
|
|
328
|
-
|
|
329
|
-
### Working with a Component Library
|
|
46
|
+
## Contributing
|
|
330
47
|
|
|
331
|
-
|
|
48
|
+
If you'd like to contribute, please refer to the [contributing guidelines](CONTRIBUTING.md).
|
|
332
49
|
|
|
333
|
-
|
|
334
|
-
import { sveltekit } from '@sveltejs/kit/vite';
|
|
335
|
-
import basicSsl from '@vitejs/plugin-basic-ssl';
|
|
336
|
-
import path from 'node:path';
|
|
337
|
-
import { fileURLToPath } from 'node:url';
|
|
50
|
+
## Community
|
|
338
51
|
|
|
339
|
-
|
|
52
|
+
For help, discussion about best practices, or any other conversation that would benefit from being searchable:
|
|
340
53
|
|
|
341
|
-
|
|
54
|
+
- [Discuss Storyblok on Github Discussions](https://github.com/storyblok/monoblok/discussions)
|
|
342
55
|
|
|
343
|
-
|
|
344
|
-
const config = {
|
|
345
|
-
plugins: [sveltekit(), basicSsl()],
|
|
346
|
-
server: {
|
|
347
|
-
https: true,
|
|
348
|
-
},
|
|
349
|
-
resolve: {
|
|
350
|
-
alias: {
|
|
351
|
-
'@storyblok/svelte': path.resolve(
|
|
352
|
-
__dirname,
|
|
353
|
-
'./node_modules/@storyblok/svelte'
|
|
354
|
-
),
|
|
355
|
-
},
|
|
356
|
-
},
|
|
357
|
-
};
|
|
56
|
+
For community support, chatting with other users, please visit:
|
|
358
57
|
|
|
359
|
-
|
|
360
|
-
```
|
|
58
|
+
- [Discuss Storyblok on Discord](https://storyblok.com/join-discord)
|
|
361
59
|
|
|
362
|
-
|
|
60
|
+
## Support
|
|
363
61
|
|
|
364
|
-
|
|
62
|
+
For bugs or feature requests, please [submit an issue](https://github.com/storyblok/monoblok/issues/new/choose).
|
|
365
63
|
|
|
366
|
-
|
|
64
|
+
> [!IMPORTANT]
|
|
65
|
+
> Please search existing issues before submitting a new one. Issues without a minimal reproducible example will be closed. [Why reproductions are Required](https://antfu.me/posts/why-reproductions-are-required).
|
|
367
66
|
|
|
368
|
-
|
|
67
|
+
### I can't share my company project code
|
|
369
68
|
|
|
370
|
-
|
|
69
|
+
We understand that you might not be able to share your company's project code. Please provide a minimal reproducible example that demonstrates the issue by using tools like [Stackblitz](https://stackblitz.com) or a link to a Github Repo lease make sure you include a README file with the instructions to build and run the project, important not to include any access token, password or personal information of any kind.
|
|
371
70
|
|
|
372
|
-
|
|
71
|
+
### Feedback
|
|
373
72
|
|
|
374
|
-
|
|
375
|
-
- [API Documentation](https://www.storyblok.com/docs/api?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte)
|
|
376
|
-
- [Developer Tutorials](https://www.storyblok.com/tutorials?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte)
|
|
377
|
-
- [Developer Guides](https://www.storyblok.com/docs/guide/introduction?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte)
|
|
378
|
-
- [FAQs](https://www.storyblok.com/faqs?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte)
|
|
73
|
+
If you have a question, please ask in the [Discuss Storyblok on Discord](https://storyblok.com/join-discord) channel.
|
|
379
74
|
|
|
380
|
-
## Support
|
|
381
75
|
|
|
382
|
-
|
|
383
|
-
- Do you have questions about Storyblok or do you need help? [Join our Discord Community](https://storyblok.com/join-discord).
|
|
384
|
-
|
|
385
|
-
## Contributing
|
|
76
|
+
## License
|
|
386
77
|
|
|
387
|
-
|
|
388
|
-
This project uses [semantic-release](https://semantic-release.gitbook.io/semantic-release/) for generating new versions by using commit messages and we use the [Angular Convention](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#) to name the commits. Check [this question](https://semantic-release.gitbook.io/semantic-release/support/faq#how-can-i-change-the-type-of-commits-that-trigger-a-release) about it in semantic-release FAQ.
|
|
78
|
+
[License](/LICENSE)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storyblok/svelte",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.2.
|
|
4
|
+
"version": "5.2.3",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "SDK to integrate Storyblok into your project using Svelte.",
|
|
7
7
|
"author": "Storyblok",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"svelte": "^5.0.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@storyblok/js": "4.2.
|
|
42
|
+
"@storyblok/js": "4.2.3"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@cypress/svelte": "^3.0.0",
|