You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/components/client-side-operations.md
+8-3Lines changed: 8 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -80,10 +80,13 @@ Configure the client by exposing settings before including the script:
80
80
81
81
### Default Templates Configuration
82
82
83
+
Modern OpenComponents uses ES6 templates by default. Legacy template types are still supported for backwards compatibility:
84
+
83
85
```js
84
86
[
87
+
// Legacy template types (supported for backwards compatibility)
85
88
{
86
-
type:"oc-template-jade",
89
+
type:"oc-template-jade",// Legacy - use ES6 templates for new components
87
90
externals: [
88
91
{
89
92
global:"jade",
@@ -103,6 +106,8 @@ Configure the client by exposing settings before including the script:
103
106
];
104
107
```
105
108
109
+
**Note**: ES6 templates are the recommended default for new components and don't require external dependencies.
110
+
106
111
## API Methods
107
112
108
113
### oc.addStylesToHead(styles)
@@ -228,7 +233,7 @@ Render a component using compiled view information and data model.
228
233
```js
229
234
oc.render(
230
235
{
231
-
type:"handlebars",
236
+
type:"es6", // Modern ES6 template (recommended)
232
237
src:"https://registry.com/component/template.js",
233
238
key:"template-hash",
234
239
},
@@ -791,7 +796,7 @@ Available settings:
791
796
|`retryInterval`|`number` (milliseconds) | Retry interval for when component rendering fails | 5000 |
792
797
|`retryLimit`|`number`| Max number of retries when component rendering fails | 30 |
793
798
|`retrySendNumber`|`boolean`| Appends an `__ocRetry=(number)` to a request to mark the retry number. This is a quite powerful feature that you can handle in the server-side logic in order to make your component even behave differently in case something is going wrong | true |
794
-
|`templates`|`array`| The configuration needed for performing client-side rendering of specific template types. |`[{"type": "oc-template-jade","externals": [{"global": "jade","url": "https://unpkg.com/[email protected]/runtime.js"}]},{"type": "oc-template-handlebars","externals": [{"global": "Handlebars","url": "https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.6/handlebars.runtime.min.js"}]}]`|
799
+
|`templates`|`array`| The configuration needed for performing client-side rendering of legacy template types. ES6 templates (default) don't require configuration.|`[{"type": "oc-template-jade","externals": [{"global": "jade","url": "https://unpkg.com/[email protected]/runtime.js"}]},{"type": "oc-template-handlebars","externals": [{"global": "Handlebars","url": "https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.6/handlebars.runtime.min.js"}]}]`|
795
800
|`tag`|`string`| The html tag you want to use for your components in the page |`oc-component`|
Copy file name to clipboardExpand all lines: website/docs/components/getting-started.md
+111-4Lines changed: 111 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,18 @@ sidebar_position: 1
4
4
5
5
# Getting Started
6
6
7
-
## Component creation
7
+
## Prerequisites
8
+
9
+
Before creating your first component, ensure you have:
10
+
11
+
-**Node.js** (version 20 or higher) - [Download here](https://nodejs.org/)
12
+
-**npm** (comes with Node.js) - Basic familiarity with npm commands
13
+
-**Basic JavaScript knowledge** - Understanding of functions, objects, and modules
14
+
-**Command line familiarity** - Ability to navigate directories and run commands
15
+
16
+
**New to OpenComponents?** Consider starting with our [Quick Start Tutorial](../quick-start-tutorial) for a complete step-by-step guide.
17
+
18
+
## Component Creation
8
19
9
20
To create a component you need to install oc with a command:
10
21
@@ -23,10 +34,10 @@ The above command will create the `hello-world` [directory](#component-structure
23
34
It is also possible to set [template](#template) type during the initialisation as an additional init parameter:
24
35
25
36
```bash
26
-
$ oc init hello-world oc-template-jade
37
+
$ oc init hello-world oc-template-es6
27
38
```
28
39
29
-
By default this parameter is set to `oc-template-handlebars`.
40
+
By default this parameter is set to `oc-template-es6` (modern ES6 templates). Legacy templates like `oc-template-handlebars` are still supported for backwards compatibility.
30
41
31
42
## Component structure
32
43
@@ -85,7 +96,7 @@ The basic package file `package.json` looks as follows:
85
96
86
97
## Template
87
98
88
-
The template represents view layer of the component. OC support `Handlebars`(via the `oc-template-handlebars`) and `Jade`(via the `oc-template-jade`) out of the box, but it come with a powerful template system to support components built with any javascript UI framework like `React`, `Angular`, `Vue`...|
99
+
The template represents view layer of the component. OC supports modern `ES6` templates by default, along with `React`, `Vue`, `Svelte`, and other javascript UI frameworks. Legacy templates like `Handlebars` and `Jade` are still supported for backwards compatibility.
89
100
90
101
Initialisation produces a basic hello-world example.
Copy file name to clipboardExpand all lines: website/docs/components/package.json-structure.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -15,13 +15,13 @@ The basic package file `package.json` looks as follows:
15
15
"files": {
16
16
"data":"server.js",
17
17
"template": {
18
-
"src":"template.hbs",
19
-
"type":"oc-template-handlebars"
18
+
"src":"template.js",
19
+
"type":"oc-template-es6"
20
20
}
21
21
}
22
22
},
23
23
"devDependencies": {
24
-
"oc-template-handlebars-compiler":"6.0.8"
24
+
"oc-template-es6-compiler":"6.0.8"
25
25
}
26
26
}
27
27
```
@@ -42,7 +42,7 @@ The basic package file `package.json` looks as follows:
42
42
|`oc.files.data`|`string`| the model provider's filename, by default `server.js`|
43
43
|`oc.files.template`|`object`| represents the data involved with template - view, template engine |
44
44
|`oc.files.template.src`|`string`| the view's filename, by default template.html |
45
-
|`oc.files.template.type`|`string`| the template engine's type, by default `handlebars`|
45
+
|`oc.files.template.type`|`string`| the template engine's type, by default `es6` (modern JavaScript templates). Legacy options like `handlebars` are still supported for backwards compatibility|
46
46
|`oc.files.static`|`array of strings`| An array of directories that contain static resources referenced from the component's markup |
47
47
|`oc.minify`|`boolean`| Default `true`, will minify static css and js files during publishing |
48
48
|`oc.parameters`|`object`| Describes the component's api. Used to auto-generate documentation and get requests validation. Each `key` is the parameter name |
0 commit comments