nibula 2.4.3 → 2.4.5

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.
@@ -1,147 +0,0 @@
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` + any other module 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
-
11
- ### examplePage.scss <small>(`src/frontend/scss/pages/`)</small>
12
- ```scss
13
- //==========================
14
- // CSS MODULES IMPORTS
15
- //==========================
16
-
17
- @use "../root" as root;
18
-
19
- @import "../global";
20
-
21
- //==========================
22
- // PAGE CUSTOM CSS RULES
23
- //==========================
24
-
25
- body {
26
- background-color: root.$primary;
27
- }
28
- ```
29
-
30
- ## Global Variables
31
-
32
- 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)
33
-
34
- ### _root.scss <small>(`src/frontend/scss/`)</small>
35
- ```scss
36
- $header-height: 10vh;
37
-
38
- // Usage example (in any other file):
39
- header {
40
- height: root.$header-height;
41
- }
42
- ```
43
-
44
- ## Scss modules
45
-
46
- 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 `_`)
47
-
48
- 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
49
-
50
- ### _yourModule.scss <small>(`src/frontend/scss/modules/subfolder/`)</small>
51
- ```scss
52
- @use '../../root' as root;
53
-
54
- @import '../../global';
55
-
56
- body {
57
- background-color: root.$primary;
58
- }
59
- ```
60
-
61
- ### examplePage.scss
62
- ```scss
63
- @import "../modules/subfolder/yourModule";
64
-
65
- // This page will now inherit the body tag rules
66
- // If the same property is declared in both, the last imported one wins
67
- body {
68
- color: root.$dark;
69
- }
70
- ```
71
-
72
- ### Pre-existing modules
73
-
74
- | File | Purpose |
75
- |---|---|
76
- | `_typography.scss` | Font rules |
77
- | `_header.scss` | Header styles |
78
- | `_footer.scss` | Footer styles |
79
- | `_mobile.scss` | Media query rules |
80
- | `_animations.scss` | Keyframe animations (`fade-in`, `spin`) |
81
- | `_markdown.scss` | Styling for Markdown rendered with `renderFile`. See **Components** DOC file |
82
-
83
- > If you don't use Markdown files as components, comment its import from `_global.scss`.
84
-
85
- ## CSS Framework
86
-
87
- Some of the most popular css frameworks that supports scss with modules are already installed in `node_modules`
88
-
89
- You can choose one or none of them (more than 1 works, but you may get in various conflicts)
90
-
91
- To enable/disable them you have to modify 3 files around the project by just commenting them
92
-
93
- ### 1. _global.scss <small>(`src/frontend/scss/`)</small>
94
- ```scss
95
- @import "modules/frameworks/bootstrap";
96
- // @import "modules/frameworks/bulma";
97
- // @import "modules/frameworks/foundation";
98
- // @import "modules/frameworks/uikit";
99
- ```
100
-
101
- ### 2. base.njk <small>(`src/frontend/layouts/`)</small>
102
-
103
- ```html
104
- {# Bootstrap JS #}
105
- <script src="{{ '/js/bootstrap.bundle.min.js' | url }}" defer></script>
106
-
107
- {# Foundation JS #}
108
- {# <script src="{{ '/js/foundation.min.js' | url }}" defer></script> #}
109
-
110
- {# UIkit JS #}
111
- {# <script src="{{ '/js/uikit.min.js' | url }}" defer></script> #}
112
- {# <script src="{{ '/js/uikit-icons.min.js' | url }}" defer></script> #}
113
-
114
- {# Bulma — no JS needed #}
115
- ```
116
-
117
- ### 3. .eleventy.js <small>(project root)</small>
118
-
119
- ```javascript
120
- eleventyConfig.addPassthroughCopy({
121
- // Bootstrap
122
- "node_modules/bootstrap/dist/js/bootstrap.bundle.min.js": "js/bootstrap.bundle.min.js",
123
- "node_modules/bootstrap-icons/font/fonts": "css/fonts",
124
-
125
- // Foundation
126
- // "node_modules/foundation-sites/dist/js/foundation.min.js": "js/foundation.min.js",
127
-
128
- // UIkit
129
- // "node_modules/uikit/dist/js/uikit.min.js": "js/uikit.min.js",
130
- // "node_modules/uikit/dist/js/uikit-icons.min.js": "js/uikit-icons.min.js",
131
-
132
- // Bulma — CSS only, no JS passthrough needed
133
- });
134
- ```
135
-
136
- > ⚠️ Changes to `.eleventy.js` are not picked up while the dev server is running — restart it.
137
-
138
- > These three files are set up for you when you pick a framework during `nib new`. You only need to edit them by hand if you change your mind later.
139
-
140
- ### Reducing bundle size
141
-
142
- To reduce the bundle size, open the corresponding framework file (`src/frontend/scss/modules/frameworks/`) and comment out any modules you don't need
143
-
144
- ```scss
145
- @import "bootstrap/scss/card"; // Cards
146
- @import "bootstrap/scss/carousel"; // Carousel
147
- ```