Skip to content

Commit b7637d3

Browse files
update public_url setting
1 parent 8d6232e commit b7637d3

File tree

3 files changed

+79
-67
lines changed

3 files changed

+79
-67
lines changed

docs/learn/3d-bits/tutorials/bitbybit-apps/settings.md

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ BITBYBIT APPS is designed exclusively for **frontend SPA development**. Any logi
7676
## Available Settings
7777

7878
### Product-Specific Settings
79-
- [Public Script URL](#public-script-url)
79+
- [Public Script URL](#public-script-url) - [See full documentation](../getting-started/common-settings#public-script-url)
8080

8181
### Global Settings
8282
- [Show Spinner](#show-spinner)
@@ -112,9 +112,13 @@ Therefore, [Public Script URL](#public-script-url) usually remains **global** (s
112112

113113
## Public Script URL
114114

115+
:::info Common Setting
116+
This setting is shared between RUNNER and APPS blocks. See [Public Script URL in Common Settings](../getting-started/common-settings#public-script-url) for general information about URL requirements, hosting options, and CORS configuration.
117+
:::
118+
115119
The Public Script URL setting controls which JavaScript application the block loads, enabling the three-mode development workflow.
116120

117-
### Three Development Modes
121+
### APPS-Specific: Three Development Modes
118122

119123
The BITBYBIT APPS block supports three distinct modes:
120124

@@ -200,41 +204,10 @@ Your Vite config must output:
200204

201205
Our templates include the correct configuration. Custom setups should follow similar patterns.
202206

203-
### Hosting Your Application
204-
205-
**Recommended: Shopify CDN (Production)**
206-
- Upload via Content → Files in Shopify Admin
207-
- Automatic CDN distribution
208-
- No CORS issues
209-
- Free hosting included
210-
- Best performance for customers
211-
212-
**Local Development/Preview**
213-
- Run Vite dev server on localhost:4242
214-
- No external hosting needed
215-
- HTTPS certificate required (handled by Vite)
216-
217-
**Alternative Hosting Options** (less common):
218-
- **Cloud Storage**: AWS S3 + CloudFront, Google Cloud Storage
219-
- **CDN Services**: Cloudflare, jsDelivr
220-
- **Your Own Server**: Any HTTPS server with CORS headers
221-
222-
:::warning Using Alternative Hosting
223-
If hosting outside Shopify, ensure proper CORS headers are configured. Shopify CDN is recommended for the simplest, most reliable setup.
207+
:::tip Hosting Options
208+
For hosting options and CORS requirements, see [Public Script URL in Common Settings](../getting-started/common-settings#public-script-url). For APPS, Shopify CDN is recommended for production, and localhost:4242 for development/preview.
224209
:::
225210

226-
### CORS Requirements
227-
228-
If your application is hosted on a different domain than your Shopify store, the server must return appropriate CORS headers:
229-
230-
```
231-
Access-Control-Allow-Origin: *
232-
Access-Control-Allow-Methods: GET, OPTIONS
233-
Access-Control-Allow-Headers: Content-Type
234-
```
235-
236-
Most CDN services handle this automatically.
237-
238211
### Application Structure with bits-pro
239212

240213
Your application uses the **bits-pro NPM package** to communicate with the BITBYBIT APPS block:

docs/learn/3d-bits/tutorials/bitbybit-runner/settings.md

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ All editors are accessible through the **3D Bits admin dashboard** in your Shopi
4141

4242
### Script Configuration
4343
- [Inline Script](#inline-script)
44-
- [Public Script URL](#public-script-url)
44+
- [Public Script URL](#public-script-url) - [See full documentation](../getting-started/common-settings#public-script-url)
4545
- [Execute JavaScript](#execute-javascript)
4646

4747
### Geometry Kernel Options
@@ -121,48 +121,34 @@ Consider using a [Public Script URL](#public-script-url) if:
121121

122122
### Public Script URL
123123

124-
The Public Script URL setting allows you to load your parametric script from an external file hosted publicly on the web.
125-
126-
#### Format
127-
128-
Provide a fully qualified URL to your script file:
129-
```
130-
https://example.com/scripts/my-configurator.txt
131-
```
132-
133-
:::warning File Requirements
134-
The URL must point to:
135-
- A **publicly accessible** file (no authentication required)
136-
- Content in **text/plain** format
137-
- A script exported using "Export to Runner" from [bitbybit.dev](https://bitbybit.dev) editors
124+
:::info Common Setting
125+
This setting is shared between RUNNER and APPS blocks. See [Public Script URL in Common Settings](../getting-started/common-settings#public-script-url) for general information about URL requirements, hosting options, and CORS configuration.
138126
:::
139127

140-
#### CORS Considerations
128+
The Public Script URL setting allows you to load your parametric script from an external file hosted publicly on the web.
141129

142-
If hosting on a different domain than your Shopify store, ensure the server returns appropriate CORS headers:
143-
```
144-
Access-Control-Allow-Origin: *
145-
```
130+
#### RUNNER-Specific Behavior
146131

147-
#### When to Use
132+
**Script Priority:**
133+
If an [Inline Script](#inline-script) is provided, it takes precedence and this URL will be ignored.
148134

149-
Use Public Script URL when:
135+
**When to Use Public Script URL:**
150136
- You have a centralized script management system
151137
- The same script is used across multiple Shopify stores
152138
- You want to update scripts without modifying the metafield values in product page (keep in mind asset may be cached)
153139
- Your script is too large for comfortable inline embedding
154140

155-
:::info Script Priority
156-
If an [Inline Script](#inline-script) is provided, it takes precedence and this URL will be ignored.
157-
:::
141+
**File Format:**
142+
The URL must point to a script exported using "Export to Runner" from [bitbybit.dev](https://bitbybit.dev) editors in text/plain format.
158143

159-
#### Hosting Options
160-
161-
You can host your script file on:
162-
- **Shopify CDN** - Upload as a theme asset
163-
- **GitHub Pages** - Use raw file URLs
144+
**Recommended Hosting:**
145+
- **Shopify CDN** - Upload as a theme asset for best reliability
146+
- **GitHub Pages** - Use raw file URLs for version control
164147
- **Cloud storage** - Google Cloud Storage, AWS S3, etc.
165-
- **Your own server** - Any web server with CORS enabled
148+
149+
:::tip
150+
For most use cases, [Inline Script](#inline-script) is recommended as it's faster (no external HTTP request) and more reliable (no dependency on external hosting).
151+
:::
166152

167153
---
168154

docs/learn/3d-bits/tutorials/getting-started/common-settings.md

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,9 @@ These settings are shared by VIEWER, RUNNER, and APPS blocks:
111111

112112
### Runner and Apps Blocks Only
113113

114-
This setting is specific to RUNNER and APPS blocks:
114+
These settings are specific to RUNNER and APPS blocks:
115115

116+
- [Public Script URL](#public-script-url)
116117
- [Disable Inputs When Computing](#disable-inputs-when-computing)
117118

118119
## Setting Details
@@ -363,6 +364,58 @@ If you're using Scene JSON Configuration with skybox or advanced backgrounds, th
363364

364365
---
365366

367+
### Public Script URL
368+
369+
**Available in:** RUNNER, APPS
370+
**Default:** Empty
371+
372+
Controls which script or application the block loads from an external source. This setting enables different workflows depending on the block type.
373+
374+
**For RUNNER Block:**
375+
Loads parametric scripts created in bitbybit.dev editors (Blockly, Rete, or Monaco). When empty, uses [Inline Script](../bitbybit-runner/settings#inline-script) instead.
376+
377+
**For APPS Block:**
378+
Controls the three-mode development workflow (Local Development, Preview, Production). When empty, defaults to `https://localhost:4242` for local development.
379+
380+
**Format:**
381+
382+
Provide a fully qualified URL to your file:
383+
```
384+
https://example.com/scripts/my-file.txt
385+
https://localhost:4242/assets/index-stable.js
386+
https://cdn.shopify.com/s/files/1/xxx/index-hash.js
387+
```
388+
389+
**File Requirements:**
390+
- **Publicly accessible** (no authentication required)
391+
- **CORS-enabled** if hosted on different domain
392+
- **RUNNER**: text/plain format with exported script from bitbybit.dev
393+
- **APPS**: ES6 module JavaScript file compiled with Vite
394+
395+
**Hosting Options:**
396+
- **Shopify CDN** - Upload via Content → Files (recommended for production)
397+
- **Local Development** - localhost:4242 (APPS only)
398+
- **Cloud Storage** - AWS S3, Google Cloud Storage, etc.
399+
- **CDN Services** - Cloudflare, jsDelivr
400+
- **Your Own Server** - Any HTTPS server with CORS headers
401+
402+
**CORS Requirements:**
403+
404+
If hosting on a different domain, ensure proper CORS headers:
405+
```
406+
Access-Control-Allow-Origin: *
407+
Access-Control-Allow-Methods: GET, OPTIONS
408+
Access-Control-Allow-Headers: Content-Type
409+
```
410+
411+
**Block-Specific Usage:**
412+
413+
For detailed usage instructions specific to each block, see:
414+
- **RUNNER**: [Public Script URL setting](../bitbybit-runner/settings#public-script-url) - Script loading and priority
415+
- **APPS**: [Public Script URL setting](../bitbybit-apps/settings#public-script-url) - Development modes and workflow
416+
417+
---
418+
366419
### Show Fullscreen Button
367420

368421
**Available in:** VIEWER, RUNNER, PREVIEW, APPS

0 commit comments

Comments
 (0)