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: README.md
+30-13Lines changed: 30 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -112,13 +112,13 @@ JSDA relies heavily on JavaScript template literals for HTML and CSS (e.g., `/*h
112
112
113
113
For the best developer experience, we strongly recommend enabling syntax highlighting for these template strings in your IDE.
114
114
115
-
If you are using **VS Code**, install the [es6-string-html](https://github.com/0x00000001A/es6-string-html) extension. This will automatically highlight HTML and CSS embedded inside your JavaScript files.
115
+
If you are using **VS Code**, install the extension (F.e. [es6-string-html](https://github.com/0x00000001A/es6-string-html)). This will highlight HTML, SVG and CSS embedded inside your JavaScript files.
116
116
117
117
### Optional TypeScript Setup
118
118
119
-
JSDA-Stack Template uses JSDoc annotations within standard JavaScript files to provide type safety via TypeScript. If you do not have TypeScript installed globally or supported natively in your IDE, you can still run type checks locally.
119
+
We use JSDoc annotations within standard JavaScript files to provide type safety via TypeScript. If you do not have TypeScript installed globally or supported natively in your IDE, you can still run type checks locally.
120
120
121
-
Simply install`typescript` as a dev dependency:
121
+
Install`typescript` as a dev dependency:
122
122
123
123
```bash
124
124
npm install -D typescript
@@ -132,7 +132,7 @@ npm run check:types
132
132
133
133
This will run `npx tsc --noEmit` to validate your types against `tsconfig.json` without unnecessary compiling the source code.
134
134
135
-
## Configuration
135
+
## Project Configuration
136
136
137
137
All project behavior is controlled via `project.cfg.js`:
138
138
@@ -149,16 +149,33 @@ All project behavior is controlled via `project.cfg.js`:
149
149
150
150
Cloud Images Toolkit is configured separately in `cit-config.json`. See the [CIT documentation](https://github.com/rnd-pro/cloud-images-toolkit) for details.
151
151
152
-
## File Conventions
152
+
## File Naming and Syntax Conventions
153
+
154
+
JSDA heavily embraces a **convention-over-configuration** approach. By leveraging strict file naming patterns, JSDA generates various types of web assets directly from JavaScript modules without requiring complex build configuration files. The default export of these modules must simply be a string (or a function returning a string) containing the raw asset data.
155
+
156
+
| Pattern | Output | Purpose |
157
+
|---|---|---|
158
+
|`[name].html.js`|`[name].html`| Dynamic HTML generator (exports an HTML string). |
159
+
|`[name].css.js`|`[name].css`| CSS module (exports a CSS string). |
160
+
|`[name].svg.js`|`[name].svg`| SVG graphic (exports an SVG markup string). |
161
+
|`[name].json.js`|`[name].json`| JSON data payload (exports a JSON string). |
During Static Site Generation (SSG), JSDA-Kit uses the file structure to reflect output path by scanning specifically for files matching the `index.*.js` pattern (which includes double extensions like `index.html.js` as well as plain `index.js`).
-`src/static-pages/app/index.js` → `dist/app/index.js` (bundled and minified automatically)
172
+
173
+
They act as the default entry points for their containing directories.
174
+
175
+
### MIME Type Resolution and Minification
176
+
177
+
The double-extension pattern (`.[ext].js`) tells JSDA-Kit exactly what the final output format is. This `[ext]` is used for **proper MIME type resolution** during dynamic serving and dictates which minification pipeline to apply during SSG builds (e.g., HTML minifier for `.html.js`, CSS minifier for `.css.js`).
153
178
154
-
| Pattern | Purpose |
155
-
|---|---|
156
-
|`*.html.js`| Page generator — default export is an HTML string |
157
-
|`*.css.js`| CSS module — default export is a CSS string |
158
-
|`*.tpl.html`| Static HTML template with `{[PLACEHOLDER]}` syntax |
159
-
|`logic.js`| Component logic (Symbiote.js class + registration) |
0 commit comments