Update getting started documentation

Remove redundant quick start section
Simplify requirements and installation
Clarify local development setup
Streamline first page creation
Add shared hosting deployment instructions
Update tutorial content structure
Improve content format explanations
Clarify asset handling
Simplify metadata documentation
Update styling documentation
Improve template explanations
Remove unnecessary examples
Make documentation more concise
This commit is contained in:
Ruben 2026-02-07 19:14:13 +01:00
parent cef370ca0c
commit 8855a9b5be
4 changed files with 226 additions and 759 deletions

View file

@ -1,62 +1,51 @@
# Styling Your Site
# Styling
FolderWeb embraces modern CSS—no preprocessors, no build steps, just the good stuff browsers support today. Let's make your site look exactly how you want.
FolderWeb uses modern CSS — no preprocessors, no build steps. Edit CSS files directly and refresh.
## Where Styles Live
FolderWeb has a simple style hierarchy:
```
custom/
├── styles/
│ ├── base.css # Your main stylesheet
│ └── custom-theme.css # Additional stylesheets (optional)
└── content/
└── my-page/
└── styles.css # Page-specific styles (optional)
└── styles/
└── base.css # Your main stylesheet
```
Page-specific styles can be placed alongside content:
```
content/portfolio/
├── index.md
└── styles.css # Loaded only on this page
```
**Loading order:**
1. `custom/styles/base.css` — Your main styles (always loaded)
2. Page-specific `styles.css`If it exists in the content directory
1. `custom/styles/base.css` — always loaded
2. Page-specific `styles.css`if present in the content directory
## Editing the Main Stylesheet
Start by editing `custom/styles/base.css`. This is where your site-wide styles live.
**Default structure:**
Edit `custom/styles/base.css` for site-wide styles:
```css
/* CSS Variables (Design Tokens) */
:root {
--color-primary: oklch(60% 0.15 250);
--color-text: oklch(20% 0 0);
--color-bg: oklch(98% 0 0);
--font-base: system-ui, -apple-system, sans-serif;
--font-mono: 'SF Mono', Monaco, monospace;
--spacing-unit: 1rem;
}
/* Base Typography */
body {
font-family: var(--font-base);
color: var(--color-text);
background: var(--color-bg);
line-height: 1.6;
}
/* More styles... */
```
Edit these values to match your brand. No build step, no compilation—just save and refresh.
## CSS Variables
## Modern CSS Features
FolderWeb encourages using modern CSS features. Here's what you should know:
### CSS Variables (Custom Properties)
Define once, use everywhere:
Define design tokens as variables, use them throughout:
```css
:root {
@ -72,32 +61,26 @@ Define once, use everywhere:
}
```
### OKLCH Colors
## OKLCH Colors
Use modern color spaces for better color manipulation:
FolderWeb's default styles use OKLCH for perceptually uniform colors:
```css
/* Traditional RGB/HSL */
--old: rgb(100, 150, 200);
--old-hsl: hsl(210, 50%, 60%);
/* Modern OKLCH (better perceptual uniformity) */
--new: oklch(65% 0.1 250);
--color: oklch(65% 0.1 250);
```
**Format:** `oklch(lightness chroma hue / alpha)`
Format: `oklch(lightness chroma hue / alpha)`
- **Lightness:** 0% (black) to 100% (white)
- **Chroma:** 0 (gray) to ~0.4 (vivid)
- **Hue:** 0-360 degrees (color wheel)
- **Hue:** 0360 degrees
### CSS Nesting
## CSS Nesting
Nest related styles without preprocessors:
Nest related styles without a preprocessor:
```css
.card {
padding: 1rem;
border-radius: 0.5rem;
& h2 {
margin-top: 0;
@ -113,50 +96,17 @@ Nest related styles without preprocessors:
}
```
### Fluid Typography with `clamp()`
## Fluid Typography
Responsive sizing without media queries:
```css
h1 {
/* Min 2rem, ideal 5vw, max 4rem */
font-size: clamp(2rem, 5vw, 4rem);
}
p {
/* Min 1rem, ideal 1.125rem, max 1.25rem */
font-size: clamp(1rem, 1.125rem, 1.25rem);
}
```
### Logical Properties
Use logical properties for better internationalization:
```css
/* Old way (assumes left-to-right) */
.old {
margin-left: 1rem;
padding-right: 2rem;
}
/* New way (respects text direction) */
.new {
margin-inline-start: 1rem;
padding-inline-end: 2rem;
}
```
**Common logical properties:**
- `margin-inline-start` / `margin-inline-end` (left/right in LTR)
- `margin-block-start` / `margin-block-end` (top/bottom)
- `padding-inline` / `padding-block`
- `inline-size` (width)
- `block-size` (height)
### Grid Layout
Use CSS Grid for layout (not flexbox for everything):
## Grid Layout
```css
.page-layout {
@ -174,17 +124,9 @@ Use CSS Grid for layout (not flexbox for everything):
}
```
## Classless CSS Philosophy
## Classless CSS
FolderWeb defaults to **classless CSS**—styling HTML elements directly instead of adding classes everywhere.
**Good (classless):**
```html
<article>
<h1>Page Title</h1>
<p>Content here.</p>
</article>
```
FolderWeb defaults to styling HTML elements directly rather than relying on classes. Since content comes from Markdown and HTML files, this means most content is styled without any classes:
```css
article {
@ -202,22 +144,11 @@ article {
}
```
**Less good (class-heavy):**
```html
<article class="article-container">
<h1 class="article-title">Page Title</h1>
<p class="article-text">Content here.</p>
</article>
```
**When to use classes:**
- Component variants (`.button-primary`, `.button-secondary`)
- JavaScript hooks (`.js-toggle`)
- Utility overrides (`.visually-hidden`)
Use classes when you need component variants, JavaScript hooks, or utility overrides.
## Page-Specific Styles
Add `styles.css` to a content directory for page-specific styling:
Add a `styles.css` file to a content directory:
```
content/portfolio/
@ -225,9 +156,7 @@ content/portfolio/
└── styles.css
```
**styles.css:**
```css
/* Scoped to this page only */
.portfolio-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
@ -235,42 +164,31 @@ content/portfolio/
}
```
FolderWeb automatically loads and includes page-specific styles with cache-busting:
FolderWeb loads it automatically with cache-busting:
```html
<link rel="stylesheet" href="/portfolio/styles.css?v=abc123def">
<link rel="stylesheet" href="/portfolio/styles.css?v=abc123">
```
## Page-Specific Scripts
For small progressive enhancements, you can add a `script.js` file to a content directory:
Add a `script.js` file to a content directory for progressive enhancement:
```
content/portfolio/
├── index.md
├── styles.css
└── script.js
```
**script.js:**
```js
// Small enhancement for this page only
document.querySelector('.portfolio-grid')?.addEventListener('click', (e) => {
// ...
});
```
FolderWeb automatically loads the script with `defer` (non-blocking) and cache-busting:
Loaded automatically with `defer`:
```html
<script defer src="/portfolio/script.js?v=abc123def"></script>
<script defer src="/portfolio/script.js?v=abc123"></script>
```
The script tag is placed before `</body>`, so it runs after the page has been parsed. This is ideal for progressive enhancement — the page works without JavaScript, but gets enhanced when it's available.
## Dark Mode
Add dark mode with CSS variables and `prefers-color-scheme`:
Use CSS variables with `prefers-color-scheme`:
```css
:root {
@ -286,21 +204,11 @@ Add dark mode with CSS variables and `prefers-color-scheme`:
}
```
All colors using the variables automatically adapt.
## Responsive Design
Use fluid layouts and relative units:
Prefer fluid CSS over fixed breakpoints:
```css
/* Bad: fixed breakpoints */
@media (min-width: 768px) {
.container {
width: 750px;
}
}
/* Good: fluid and flexible */
.container {
width: min(90%, 1200px);
padding: clamp(1rem, 3vw, 3rem);
@ -313,147 +221,19 @@ Use fluid layouts and relative units:
}
```
**Use media queries sparingly:**
- Layout changes (sidebar position)
- Font size adjustments
- Complex interactions
**Prefer fluid CSS:**
- Spacing (`clamp()`)
- Typography (`clamp()`)
- Grids (`auto-fit`, `minmax()`)
Use media queries only when layout needs to change fundamentally (e.g., sidebar position).
## Cache Busting
FolderWeb automatically versions CSS files with MD5 hashes:
FolderWeb versions CSS files with MD5 hashes automatically:
```html
<link rel="stylesheet" href="/custom/styles/base.css?v=a1b2c3d4">
```
When you edit your CSS, the hash changes and browsers fetch the new version. No manual cache clearing needed.
When you edit your CSS, the hash changes and browsers fetch the new version.
## Practical Examples
## Next Steps
### Simple Blog Theme
```css
:root {
--color-accent: oklch(55% 0.15 220);
--color-text: oklch(25% 0 0);
--color-bg: oklch(99% 0 0);
--max-width: 65ch;
}
body {
font-family: Georgia, serif;
color: var(--color-text);
background: var(--color-bg);
padding: 2rem 1rem;
}
article {
max-width: var(--max-width);
margin: 0 auto;
& h1 {
font-size: clamp(2rem, 5vw, 3rem);
color: var(--color-accent);
}
& p {
line-height: 1.8;
margin-bottom: 1.5rem;
}
}
```
### Portfolio Grid
```css
.project-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
gap: 2rem;
padding: 2rem 0;
}
.project-card {
border-radius: 0.5rem;
overflow: hidden;
box-shadow: 0 2px 8px oklch(0% 0 0 / 0.1);
transition: transform 0.2s;
&:hover {
transform: translateY(-4px);
box-shadow: 0 4px 16px oklch(0% 0 0 / 0.15);
}
& img {
width: 100%;
aspect-ratio: 16 / 9;
object-fit: cover;
}
& h3 {
padding: 1rem;
margin: 0;
}
}
```
### Documentation Site
```css
:root {
--sidebar-width: 250px;
}
.docs-layout {
display: grid;
grid-template-columns: var(--sidebar-width) 1fr;
gap: 3rem;
max-width: 1400px;
margin: 0 auto;
@media (max-width: 900px) {
grid-template-columns: 1fr;
}
}
.sidebar nav {
position: sticky;
top: 2rem;
& ul {
list-style: none;
padding: 0;
}
& a {
display: block;
padding: 0.5rem 1rem;
text-decoration: none;
border-radius: 0.25rem;
&:hover {
background: var(--color-bg-hover);
}
}
}
```
## Tips
- **Start simple:** Edit colors and fonts first, then tackle layout
- **Use the inspector:** Browser dev tools show computed values and help debug
- **Test in different browsers:** Modern CSS has excellent support, but always verify
- **Keep it readable:** Future you will thank present you for clear, organized styles
## What's Next?
Now that you can style your site, learn how to:
- **[Create custom templates](#)** — Control HTML structure and layout
- **[Add multilingual support](#)** — Style for different languages and text directions
Or explore the [Reference](#) for detailed documentation on all available template variables and hooks.
- [Templates](03-templates.md) — Control HTML structure and layout
- [Internationalization](../03-reference/04-internationalization.md) — Multi-language support