nibula 1.0.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.
Files changed (81) hide show
  1. package/.eleventy.js +96 -0
  2. package/.eleventyignore +4 -0
  3. package/CHANGELOG.md +0 -0
  4. package/LICENSE +170 -0
  5. package/NOTICE +5 -0
  6. package/README.md +105 -0
  7. package/_tools/assistant.js +152 -0
  8. package/_tools/buildJs.js +37 -0
  9. package/_tools/cleanOutput.js +25 -0
  10. package/_tools/modules/constants.js +66 -0
  11. package/_tools/modules/pageComponents.js +77 -0
  12. package/_tools/modules/updateData.js +90 -0
  13. package/_tools/modules/updateOutputPath.js +112 -0
  14. package/_tools/modules/updatePage.js +162 -0
  15. package/_tools/modules/utils.js +27 -0
  16. package/_tools/modules/validation.js +30 -0
  17. package/_tools/res/templates/template.js +5 -0
  18. package/_tools/res/templates/template.njk +9 -0
  19. package/_tools/res/templates/template.scss +23 -0
  20. package/_tools/res/templates/template.ts +5 -0
  21. package/bin/create.js +407 -0
  22. package/bin/nibula.js +281 -0
  23. package/docs/Assistant CLI.md +66 -0
  24. package/docs/Backend.md +151 -0
  25. package/docs/Components.md +96 -0
  26. package/docs/Creating pages.md +65 -0
  27. package/docs/Deploy.md +101 -0
  28. package/docs/Head and SEO.md +117 -0
  29. package/docs/Javascript.md +53 -0
  30. package/docs/Styling with SCSS.md +136 -0
  31. package/nginx.conf +47 -0
  32. package/nibula-1.0.0.tgz +0 -0
  33. package/package.json +74 -0
  34. package/src/backend/.htaccess +7 -0
  35. package/src/backend/_core/composer.json +5 -0
  36. package/src/backend/_core/composer.lock +492 -0
  37. package/src/backend/_core/index.php +148 -0
  38. package/src/backend/_core/init.php +34 -0
  39. package/src/backend/_core/modules/RateLimiter.php +31 -0
  40. package/src/backend/_core/modules/Response.php +49 -0
  41. package/src/backend/api/protected/example-protected.php +17 -0
  42. package/src/backend/api/public/example-public.php +17 -0
  43. package/src/backend/database/Database.php +24 -0
  44. package/src/backend/database/migrations/create_example_db.sql +1 -0
  45. package/src/backend/example.config.php +28 -0
  46. package/src/backend/web.config +17 -0
  47. package/src/frontend/.htaccess +16 -0
  48. package/src/frontend/404.njk +17 -0
  49. package/src/frontend/assets/brand/favicon.svg +37 -0
  50. package/src/frontend/assets/brand/logo.svg +37 -0
  51. package/src/frontend/components/global/footer.njk +25 -0
  52. package/src/frontend/components/global/header.njk +7 -0
  53. package/src/frontend/components/welcome.njk +116 -0
  54. package/src/frontend/data/site.json +54 -0
  55. package/src/frontend/index.njk +9 -0
  56. package/src/frontend/js/modules/exampleModule.js +3 -0
  57. package/src/frontend/js/pages/404.js +7 -0
  58. package/src/frontend/js/pages/homepage.js +7 -0
  59. package/src/frontend/layouts/base.njk +142 -0
  60. package/src/frontend/layouts/page-components.njk +14 -0
  61. package/src/frontend/llms.njk +18 -0
  62. package/src/frontend/robots.njk +8 -0
  63. package/src/frontend/scss/modules/_animations.scss +25 -0
  64. package/src/frontend/scss/modules/_footer.scss +28 -0
  65. package/src/frontend/scss/modules/_global.scss +44 -0
  66. package/src/frontend/scss/modules/_header.scss +28 -0
  67. package/src/frontend/scss/modules/_mobile.scss +30 -0
  68. package/src/frontend/scss/modules/_root.scss +35 -0
  69. package/src/frontend/scss/modules/_typography.scss +15 -0
  70. package/src/frontend/scss/modules/frameworks/_bootstrap.scss +110 -0
  71. package/src/frontend/scss/modules/frameworks/_bulma.scss +109 -0
  72. package/src/frontend/scss/modules/frameworks/_foundation.scss +139 -0
  73. package/src/frontend/scss/modules/frameworks/_uikit.scss +110 -0
  74. package/src/frontend/scss/pages/404.scss +28 -0
  75. package/src/frontend/scss/pages/homepage.scss +23 -0
  76. package/src/frontend/sitemap.njk +18 -0
  77. package/src/frontend/ts/modules/exampleModule.ts +3 -0
  78. package/src/frontend/ts/pages/404.ts +7 -0
  79. package/src/frontend/ts/pages/homepage.ts +7 -0
  80. package/src/frontend/web.config +27 -0
  81. package/tsconfig.json +25 -0
@@ -0,0 +1,136 @@
1
+ # Styling with SCSS
2
+
3
+ ## Page CSS
4
+
5
+ Each page has its own SCSS entry point in `src/frontend/scss/pages/`
6
+
7
+ It must contain `_root.scss` + other modules like `_global.scss` or any other one that you need and its own specific css rules
8
+
9
+ `_root.scss` uses `@use` to enable namespaced access (`root.$var`); other modules use `@import` as they don't expose variables.
10
+ ### examplePage.scss <small>(`src/frontend/scss/pages/`)</small>
11
+ ```scss
12
+ //==========================
13
+ // CSS MODULES IMPORTS
14
+ //==========================
15
+
16
+ @use "../modules/root" as root;
17
+
18
+ @import "../modules/global";
19
+
20
+ //==========================
21
+ // PAGE CUSTOM CSS RULES
22
+ //==========================
23
+
24
+ body {
25
+ background-color: root.$primary;
26
+ }
27
+ ```
28
+
29
+ ## Global Variables
30
+
31
+ Instead of using `:root` in your custom modules or pages, the best thing to do is to centralize all your variables in a single file (that will be tree-shaken automatically by Sass)
32
+
33
+ ### _root.scss <small>(`src/frontend/scss/modules/`)</small>
34
+ ```scss
35
+ $header-height: 10vh;
36
+
37
+ // Usage example (in any other file):
38
+ header {
39
+ height: root.$header-height;
40
+ }
41
+ ```
42
+ ## Scss modules
43
+ You can create your custom css modules by creating a new `.scss` file in `src/frontend/scss/modules/` (the name of the file must start with `_`)
44
+
45
+ You can create subfolders if you want to refactor the structure, but be sure to update the relative paths in the pages that import them
46
+
47
+ ### _yourModule.scss <small>(`src/frontend/scss/modules/subfolder/`)</small>
48
+ ```scss
49
+ @use '../root' as root;
50
+
51
+ body {
52
+ background-color: root.$primary;
53
+ }
54
+ ```
55
+
56
+ ### examplePage.scss
57
+ ```scss
58
+ @import "../modules/subfolder/yourModule";
59
+
60
+ // This page will now inherit the body tag rules
61
+ // If the same property is declared in both, the last imported one wins
62
+ body {
63
+ color: root.$dark;
64
+ }
65
+ ```
66
+
67
+ ### Pre-existing modules
68
+
69
+ | File | Purpose |
70
+ |---|---|
71
+ | `_root.scss` | Global variables (colors, spacing) |
72
+ | `_global.scss` | Site-wide base rules and frameworks |
73
+ | `_typography.scss` | Font rules
74
+ | `_header.scss` | Header styles |
75
+ | `_footer.scss` | Footer styles |
76
+ | `_mobile.scss` | Media query rules |
77
+ | `_animations.scss` | Keyframe animations (`fade-in`, `spin`) |
78
+
79
+ ## CSS Framework
80
+
81
+ Some of the most popular css frameworks that supports scss with modules are already installed in `node_modules`
82
+
83
+ You can choose one or none of them (more than 1 works, but you may get in various conflicts)
84
+
85
+ To enable/disable them you have to modify 3 files around the project by just commenting them
86
+
87
+
88
+ ### 1. _global.scss <small>(`src/frontend/scss/modules/`)</small>
89
+ ```scss
90
+ @import "../modules/frameworks/bootstrap";
91
+ // @import "../modules/frameworks/bulma";
92
+ // @import "../modules/frameworks/foundation";
93
+ // @import "../modules/frameworks/uikit";
94
+ ```
95
+
96
+ ### 2. base.njk <small>(`src/frontend/layouts/`)</small>
97
+
98
+ ```html
99
+ {# Bootstrap JS #}
100
+ <script src="/js/bootstrap.bundle.min.js" defer></script>
101
+
102
+ {# Foundation JS #}
103
+ {# <script src="/js/foundation.min.js" defer></script> #}
104
+
105
+ {# UIkit JS #}
106
+ {# <script src="/js/uikit.min.js" defer></script> #}
107
+ {# <script src="/js/uikit-icons.min.js" defer></script> #}
108
+
109
+ {# Bulma — no JS needed #}
110
+ ```
111
+
112
+ ### 3. .eleventy.js
113
+
114
+ ```javascript
115
+ eleventyConfig.addPassthroughCopy({
116
+ // Bootstrap
117
+ "node_modules/bootstrap/dist/js/bootstrap.bundle.min.js": "js/bootstrap.bundle.min.js",
118
+ "node_modules/bootstrap-icons/font/fonts": "css/fonts",
119
+
120
+ // Foundation
121
+ // "node_modules/foundation-sites/dist/js/foundation.min.js": "js/foundation.min.js",
122
+
123
+ // UIkit
124
+ // "node_modules/uikit/dist/js/uikit.min.js": "js/uikit.min.js",
125
+ // "node_modules/uikit/dist/js/uikit-icons.min.js": "js/uikit-icons.min.js",
126
+
127
+ // Bulma — CSS only, no JS passthrough needed
128
+ });
129
+ ```
130
+
131
+ ### Reducing bundle size
132
+ To reduce the bundle size, open the corresponding framework file (`src/frontend/scss/modules/frameworks/`) and comment out any modules you don't need
133
+ ```scss
134
+ @import "bootstrap/scss/card"; // Cards
135
+ @import "bootstrap/scss/carousel"; // Carousel
136
+ ```
package/nginx.conf ADDED
@@ -0,0 +1,47 @@
1
+ # Hide the nginx version from response headers
2
+ server_tokens off;
3
+
4
+ # Force HTTPS on future requests (applies site-wide, including /api)
5
+ add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
6
+
7
+ root /var/www/html/out;
8
+ index index.html;
9
+
10
+ # Disable directory listing
11
+ autoindex off;
12
+
13
+ error_page 403 404 /404.html;
14
+ location = /404.html {
15
+ internal;
16
+ }
17
+
18
+ # Never expose the backend source directory
19
+ location ^~ /backend/ {
20
+ return 404;
21
+ }
22
+
23
+ # Block server config files anywhere in the tree (.htaccess, web.config).
24
+ # return 404 is served internally as /404.html via error_page above.
25
+ location ~* (^|/)(\.htaccess|web\.config)$ {
26
+ return 404;
27
+ }
28
+
29
+ # Route all /api/ requests to the PHP front controller.
30
+ # Security headers for API responses are set by the front controller (PHP).
31
+ location ^~ /api/ {
32
+ try_files $uri =404;
33
+ fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
34
+ fastcgi_param SCRIPT_FILENAME $document_root/backend/_core/index.php;
35
+ include fastcgi_params;
36
+ }
37
+
38
+ # Serve static files, fall back to the 404 page.
39
+ # A location with add_header does not inherit server-level headers,
40
+ # so Strict-Transport-Security is repeated here.
41
+ location / {
42
+ add_header X-Content-Type-Options "nosniff" always;
43
+ add_header X-Frame-Options "SAMEORIGIN" always;
44
+ add_header Referrer-Policy "strict-origin-when-cross-origin" always;
45
+ add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
46
+ try_files $uri $uri/ /404.html;
47
+ }
Binary file
package/package.json ADDED
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "nibula",
3
+ "version": "1.0.0",
4
+ "description": "A beginner-friendly static site generator built on Eleventy that stays close to vanilla HTML, CSS and JS — with a page-management CLI, an optional PHP backend, and SEO files generated for you.",
5
+ "keywords": [
6
+ "static-site-generator",
7
+ "ssg",
8
+ "eleventy",
9
+ "11ty",
10
+ "boilerplate",
11
+ "starter",
12
+ "scaffolding",
13
+ "cli",
14
+ "vanilla",
15
+ "vanilla-js",
16
+ "html",
17
+ "css",
18
+ "scss",
19
+ "sass",
20
+ "njk",
21
+ "nunjucks",
22
+ "components",
23
+ "backend",
24
+ "php",
25
+ "node",
26
+ "python",
27
+ "beginner-friendly",
28
+ "seo",
29
+ "sitemap",
30
+ "website-template",
31
+ "frontend"
32
+ ],
33
+ "author": "Michele Garofalo",
34
+ "license": "Apache-2.0",
35
+ "homepage": "https://github.com/Rhaastrake/Nibula#readme",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "git+https://github.com/Rhaastrake/Nibula.git"
39
+ },
40
+ "bugs": {
41
+ "url": "https://github.com/Rhaastrake/Nibula/issues"
42
+ },
43
+ "outputDir": "out",
44
+ "bin": {
45
+ "nib": "bin/nibula.js",
46
+ "nbl": "bin/nibula.js",
47
+ "nibula": "bin/nibula.js"
48
+ },
49
+ "scripts": {
50
+ "build:css": "sass src/frontend/scss:out/css --no-source-map --style=compressed --quiet",
51
+ "build:js": "esbuild \"src/frontend/ts/pages/*.ts\" --bundle --outdir=out/js/pages --minify",
52
+ "build:11ty": "eleventy",
53
+ "build": "npm run clean && npm run build:css && npm run build:js && npm run build:11ty",
54
+ "serve:css": "sass --watch src/frontend/scss:out/css --no-source-map --quiet",
55
+ "serve:js": "esbuild \"src/frontend/ts/pages/*.ts\" --bundle --outdir=out/js/pages --watch",
56
+ "serve:11ty": "eleventy --serve --quiet",
57
+ "clean": "node _tools/cleanOutput.js",
58
+ "serve": "npm run clean && concurrently \"npm run serve:11ty\" \"npm run serve:css\" \"npm run serve:js\"",
59
+ "assistant": "node _tools/assistant.js"
60
+ },
61
+ "devDependencies": {
62
+ "@11ty/eleventy": "^3.1.2",
63
+ "@11ty/eleventy-img": "^6.0.4",
64
+ "bootstrap": "^5.3.8",
65
+ "bootstrap-icons": "^1.13.1",
66
+ "bulma": "^1.0.4",
67
+ "concurrently": "^9.2.1",
68
+ "esbuild": "^0.27.3",
69
+ "foundation-sites": "^6.9.0",
70
+ "glob": "^13.0.6",
71
+ "sass": "^1.77.0",
72
+ "uikit": "^3.25.13"
73
+ }
74
+ }
@@ -0,0 +1,7 @@
1
+ <IfModule mod_rewrite.c>
2
+ RewriteEngine On
3
+ RewriteBase /api/
4
+
5
+ RewriteRule ^_core/index\.php$ - [L]
6
+ RewriteRule ^(.*)$ _core/index.php [QSA,L]
7
+ </IfModule>
@@ -0,0 +1,5 @@
1
+ {
2
+ "require": {
3
+ "vlucas/phpdotenv": "^5.6"
4
+ }
5
+ }