create-berna-stencil 2.5.0 → 2.6.0
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/.eleventy.js +1 -1
- package/README.md +5 -1
- package/_tools/modules/updateIncludes.js +5 -5
- package/_tools/res/templates/template.njk +2 -2
- package/bin/create.js +2 -2
- package/docs/Assistant CLI.md +3 -3
- package/docs/Components.md +4 -4
- package/docs/Creating pages.md +3 -3
- package/docs/Styling with SCSS.md +1 -1
- package/package.json +1 -1
- package/src/frontend/index.njk +2 -2
- package/src/frontend/{components/layouts → layouts}/base.njk +1 -1
- /package/src/frontend/{components/layouts/includes.njk → layouts/pageComponents.njk} +0 -0
package/.eleventy.js
CHANGED
package/README.md
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
# ✏️ Berna-Stencil
|
|
2
2
|
**Berna-Stencil** is an open source static site generator built on top of [Eleventy](https://www.11ty.dev/), designed with one clear mission: make web development simple, approachable, and enjoyable — for everyone.
|
|
3
3
|
|
|
4
|
+
Berna-Stencil stays deliberately close to plain, vanilla web development — you work with real HTML, CSS, and JavaScript, not a heavy abstraction layer to learn first. That means a gentle, fast learning curve: the skills you build here are the same ones you'd use anywhere on the web.
|
|
5
|
+
|
|
4
6
|
Whether you're a seasoned developer looking for a clean starting point or a beginner taking your first steps into the world of web creation, Berna-Stencil gives you everything you need, right out of the box. No complicated setup, no hours spent reading documentation, no frustration — just a solid, well-structured foundation ready to become your next website.
|
|
5
7
|
|
|
6
8
|
### ✨ Why Berna-Stencil?
|
|
7
9
|
|
|
8
10
|
Building a website from scratch involves a lot of moving parts: templating engines, build pipelines, asset management, backend logic, project structure. Berna-Stencil takes care of all of that for you, so you can focus on what actually matters — **your content and your ideas**.
|
|
9
11
|
|
|
12
|
+
Because it keeps you close to the fundamentals instead of hiding them, you spend your time actually learning the web — not memorizing a framework's conventions that stop being useful the moment you switch tool.
|
|
13
|
+
|
|
10
14
|
- 🔧 **Zero-config ready** — clone, install, and you're live in minutes
|
|
11
15
|
- 🔗 **Integrated backend** — essential server-side functionality included, no extra setup required
|
|
12
16
|
- 📁 **Scalable structure** — a clean, opinionated project layout that grows with your needs
|
|
13
17
|
- 🌍 **Open source** — free to use, free to modify, free to share
|
|
14
18
|
|
|
15
|
-

|
|
16
20
|

|
|
17
21
|

|
|
18
22
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
const fileSystem = require('fs');
|
|
2
2
|
const { toCamelCase } = require('./utils');
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const PAGE_COMPONENTS_PATH = 'src/frontend/layouts/pageComponents.njk';
|
|
5
5
|
|
|
6
6
|
// --- Helpers ---
|
|
7
7
|
|
|
8
8
|
function readIncludes() {
|
|
9
|
-
if (!fileSystem.existsSync(
|
|
10
|
-
return fileSystem.readFileSync(
|
|
9
|
+
if (!fileSystem.existsSync(PAGE_COMPONENTS_PATH)) return null;
|
|
10
|
+
return fileSystem.readFileSync(PAGE_COMPONENTS_PATH, 'utf8');
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
function writeIncludes(content) {
|
|
14
|
-
fileSystem.writeFileSync(
|
|
14
|
+
fileSystem.writeFileSync(PAGE_COMPONENTS_PATH, content);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
function buildElifRegex(camelName) {
|
|
@@ -32,7 +32,7 @@ function addLayout(pageName) {
|
|
|
32
32
|
|
|
33
33
|
const newElif =
|
|
34
34
|
`{% elif title == "${camelName}" %}\n` +
|
|
35
|
-
` {# Insert your
|
|
35
|
+
` {# Insert your components under this page #}\n` +
|
|
36
36
|
` {#{% include "component.njk" %}#}\n\n`;
|
|
37
37
|
|
|
38
38
|
writeIncludes(content.replace('{% else %}', `${newElif}{% else %}`));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: ""
|
|
3
3
|
permalink: ""
|
|
4
|
-
layout:
|
|
4
|
+
layout: pageComponents.njk
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
<!-- !IMPORTANT -->
|
|
8
8
|
<!-- DO NOT ADD ANYTHING HERE -->
|
|
9
|
-
<!-- You should create a new component.njk into src/frontend
|
|
9
|
+
<!-- You should create a new component.njk into src/frontend and include that in layouts/pageComponents.njk -->
|
package/bin/create.js
CHANGED
|
@@ -121,7 +121,7 @@ src/backend/config.php
|
|
|
121
121
|
|
|
122
122
|
const PROJECT_PACKAGE = {
|
|
123
123
|
name: path.basename(targetDir),
|
|
124
|
-
version: '2.
|
|
124
|
+
version: '2.6.0',
|
|
125
125
|
private: true,
|
|
126
126
|
outputDir: 'out',
|
|
127
127
|
"scripts": {
|
|
@@ -226,7 +226,7 @@ function applyFramework(framework) {
|
|
|
226
226
|
fs.writeFileSync(globalScssPath, content);
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
-
const baseNjkPath = path.join(targetDir, 'src/frontend/
|
|
229
|
+
const baseNjkPath = path.join(targetDir, 'src/frontend/layouts/base.njk');
|
|
230
230
|
if (fs.existsSync(baseNjkPath)) {
|
|
231
231
|
let content = fs.readFileSync(baseNjkPath, 'utf8');
|
|
232
232
|
ALL_FRAMEWORKS.forEach(fw => {
|
package/docs/Assistant CLI.md
CHANGED
|
@@ -31,7 +31,7 @@ For a page named `my-page`, the following files are created:
|
|
|
31
31
|
| `src/frontend/js/pages/myPage.js` | JS entry point |
|
|
32
32
|
| `src/frontend/_routes/my-page.njk` | Nunjucks template |
|
|
33
33
|
|
|
34
|
-
It also adds an `elif` block in `
|
|
34
|
+
It also adds an `elif` block in `pageComponents.njk` and a stub entry in `site.json`:
|
|
35
35
|
|
|
36
36
|
```json
|
|
37
37
|
"myPage": {
|
|
@@ -48,11 +48,11 @@ It also adds an `elif` block in `includes.njk` and a stub entry in `site.json`:
|
|
|
48
48
|
|
|
49
49
|
## Remove page
|
|
50
50
|
|
|
51
|
-
Deletes all source files for the page and cleans up the output directory, `
|
|
51
|
+
Deletes all source files for the page and cleans up the output directory, `pageComponents.njk`, and `site.json`.
|
|
52
52
|
|
|
53
53
|
## Rename page
|
|
54
54
|
|
|
55
|
-
Renames all three source files, updates the `elif` block in `
|
|
55
|
+
Renames all three source files, updates the `elif` block in `pageComponents.njk`, and renames the record in `site.json` while preserving all existing fields.
|
|
56
56
|
|
|
57
57
|
## Configure output path
|
|
58
58
|
|
package/docs/Components.md
CHANGED
|
@@ -19,9 +19,9 @@ src/frontend/components/
|
|
|
19
19
|
|
|
20
20
|
## Include a component
|
|
21
21
|
|
|
22
|
-
To render a component inside a page, navigate to `src/frontend/
|
|
22
|
+
To render a component inside a page, navigate to `src/frontend/layouts/` and edit `pageComponents.njk`
|
|
23
23
|
|
|
24
|
-
###
|
|
24
|
+
### pageComponents.njk <small>(`src/frontend/layouts/`)</small>
|
|
25
25
|
|
|
26
26
|
```js
|
|
27
27
|
{% if title == "homepage" %}
|
|
@@ -41,7 +41,7 @@ Add a new `{% elif %}` block for each page, listing its components in order. If
|
|
|
41
41
|
|
|
42
42
|
> ⚠️ A new `elif` block is automatically added when you create a page via the Assistant CLI
|
|
43
43
|
|
|
44
|
-
> ⚠️ If you move or delete a component, always update `
|
|
44
|
+
> ⚠️ If you move or delete a component, always update `pageComponents.njk` or the site will break
|
|
45
45
|
|
|
46
46
|
### Using Markdown files in components
|
|
47
47
|
|
|
@@ -75,7 +75,7 @@ Header and footer live in `src/frontend/components/global/` and are automaticall
|
|
|
75
75
|
|
|
76
76
|
## Site data in components
|
|
77
77
|
|
|
78
|
-
All values defined in `src/data/site.json` are globally available in every component via `{{ site.* }}`
|
|
78
|
+
All values defined in `src/frontend/data/site.json` are globally available in every component via `{{ site.* }}`
|
|
79
79
|
|
|
80
80
|
### site.json <small>(`src/data/`)</small>
|
|
81
81
|
```json
|
package/docs/Creating pages.md
CHANGED
|
@@ -9,14 +9,14 @@ For a page named `my-page`:
|
|
|
9
9
|
|
|
10
10
|
| File | Purpose |
|
|
11
11
|
|---|---|
|
|
12
|
-
| `src/frontend/
|
|
12
|
+
| `src/frontend/_routes_/my-page.njk` | Template with front matter |
|
|
13
13
|
| `src/frontend/scss/pages/myPage.scss` | Imports framework + modules |
|
|
14
14
|
| `src/frontend/js/pages/myPage.js` | Imports JS modules |
|
|
15
15
|
|
|
16
16
|
## Adding content
|
|
17
17
|
|
|
18
18
|
1. Create a component in `src/frontend/components/` (e.g. `_myPage.njk`)
|
|
19
|
-
2. Include it in `src/frontend/
|
|
19
|
+
2. Include it in `src/frontend/layouts/pageComponents.njk` inside the generated `elif` block:
|
|
20
20
|
|
|
21
21
|
```njk
|
|
22
22
|
{% elif title == "myPage" %}
|
|
@@ -37,7 +37,7 @@ To create a URL like `domain.it/about/team`, edit the `permalink` in `src/fronte
|
|
|
37
37
|
---
|
|
38
38
|
title: "team"
|
|
39
39
|
permalink: "about/team/"
|
|
40
|
-
layout:
|
|
40
|
+
layout: pageComponents.njk
|
|
41
41
|
---
|
|
42
42
|
```
|
|
43
43
|
|
|
@@ -97,7 +97,7 @@ To enable/disable them you have to modify 3 files around the project by just com
|
|
|
97
97
|
// @import "../modules/frameworks/uikit";
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
### 2. base.njk <small>(`src/frontend/
|
|
100
|
+
### 2. base.njk <small>(`src/frontend/layouts/`)</small>
|
|
101
101
|
|
|
102
102
|
```html
|
|
103
103
|
{# Bootstrap JS #}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-berna-stencil",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "Eleventy boilerplate with per-page SCSS/JS pipeline, esbuild bundling, multi-framework CSS support and a built-in page management CLI",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "Michele Garofalo",
|
package/src/frontend/index.njk
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: homepage
|
|
3
3
|
permalink: /
|
|
4
|
-
layout:
|
|
4
|
+
layout: pageComponents.njk
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
<!-- !IMPORTANT -->
|
|
8
8
|
<!-- DO NOT ADD ANYTHING HERE -->
|
|
9
|
-
<!-- You should create a new component.njk into src/components and include that in
|
|
9
|
+
<!-- You should create a new component.njk into src/components and include that in layouts/pageComponents.njk -->
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
<meta name="twitter:image" content="{{ site.url }}{{ site.logo }}">
|
|
44
44
|
|
|
45
45
|
{#╔══════════════════════════════════════════╗
|
|
46
|
-
║ JSON-LD — Structured data for SEO/AI
|
|
46
|
+
║ JSON-LD — Structured data for SEO/AI ║
|
|
47
47
|
╚══════════════════════════════════════════╝#}
|
|
48
48
|
|
|
49
49
|
<script type="application/ld+json">
|
|
File without changes
|