Skip to content

Commit 3021d86

Browse files
authored
static (#97)
* static * docs
1 parent 45712fa commit 3021d86

File tree

5 files changed

+245
-52
lines changed

5 files changed

+245
-52
lines changed

docs/Configuration/Other Customisations.md

Lines changed: 170 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,183 @@ sidebar_position: 13
55

66
Stirling PDF offers various other customisation options, such as:
77

8-
### Defaulting Language
8+
## Static File Overrides
9+
10+
You can override static files (logos, images, favicons, etc.) by placing custom versions in the `customFiles/static/` directory.
11+
12+
### How It Works
13+
14+
Stirling-PDF checks for files in this order:
15+
1. **First:** `customFiles/static/` (your custom files)
16+
2. **Fallback:** Built-in static files embedded in the application
17+
18+
This means you can replace any static resource by placing a file with the matching path in `customFiles/static/`.
19+
20+
### Finding File Paths to Override
21+
22+
Static files in the application come from the `frontend/public/` folder in the source code. The mapping is direct:
23+
24+
**Frontend source → Your override path:**
25+
- `frontend/public/favicon.svg``customFiles/static/favicon.svg`
26+
- `frontend/public/modern-logo/logo.svg``customFiles/static/modern-logo/logo.svg`
27+
- `frontend/public/classic-logo/logo.svg``customFiles/static/classic-logo/logo.svg`
28+
29+
**To see what files you can override:**
30+
1. Browse the [frontend/public folder on GitHub](https://github.com/Stirling-Tools/Stirling-PDF/tree/main/frontend/public)
31+
2. Match the directory structure in your `customFiles/static/` folder
32+
33+
Common files you might want to override:
34+
35+
**Favicons & Icons:**
36+
- `favicon.svg`, `favicon.ico` - Browser favicons
37+
- `apple-touch-icon.png` - iOS home screen icon
38+
- `android-chrome-192x192.png` - Android icon (192x192)
39+
- `android-chrome-512x512.png` - Android icon (512x512)
40+
41+
**Logo Variants (Both classic-logo/ and modern-logo/):**
42+
43+
Both logo directories contain the same file structure - just replace `classic-logo/` or `modern-logo/` with whichever style you're using:
44+
45+
- `{style}/StirlingPDFLogoBlackText.svg` - Logo with black text (light mode)
46+
- `{style}/StirlingPDFLogoWhiteText.svg` - Logo with white text (dark mode)
47+
- `{style}/StirlingPDFLogoGreyText.svg` - Logo with grey text
48+
- `{style}/StirlingPDFLogoNoTextDark.svg` - Logo without text (dark variant)
49+
- `{style}/StirlingPDFLogoNoTextLight.svg` - Logo without text (light variant)
50+
- `{style}/logo-tooltip.svg` - Small logo for tooltips
51+
- `{style}/favicon.ico` - Style-specific favicon
52+
- `{style}/logo192.png`, `{style}/logo512.png` - PNG versions at different sizes
53+
- `{style}/Firstpage.png` - First page preview image
54+
55+
Where `{style}` is either `classic-logo` or `modern-logo` depending on your logo style setting:
56+
57+
**Settings file (configs/settings.yml):**
58+
```yaml
59+
ui:
60+
logoStyle: classic # Options: 'classic' or 'modern'
61+
```
62+
63+
**Environment variable (Docker):**
64+
```bash
65+
UI_LOGOSTYLE=classic
66+
```
67+
68+
**In-app configuration:**
69+
Settings → UI → Logo Style (requires login enabled)
70+
71+
**Other Assets:**
72+
- `moon.svg` - Dark mode toggle icon
73+
- `robots.txt` - Search engine directives
74+
- `manifest.json`, `manifest-classic.json` - Web app manifests
75+
- Images, fonts, and locales
76+
77+
### Example: Custom Favicon
78+
79+
```bash
80+
# Your directory structure
81+
customFiles/
82+
└── static/
83+
├── favicon.svg
84+
└── favicon.ico
85+
```
86+
87+
Docker compose:
88+
```yaml
89+
volumes:
90+
- ./customFiles:/customFiles:rw
91+
```
92+
93+
Restart the container - your custom favicons will be used!
94+
95+
### Example: Custom Logo (Simple)
96+
97+
```bash
98+
customFiles/
99+
└── static/
100+
└── classic-logo/
101+
└── StirlingPDFLogoBlackText.svg
102+
```
103+
104+
This overrides the classic logo with black text (used in light mode).
105+
106+
**Important:** Make sure your logo style is set to `classic` in your configuration:
107+
```yaml
108+
ui:
109+
logoStyle: classic # Must match the directory you're overriding!
110+
```
111+
112+
Or via environment variable:
113+
```bash
114+
UI_LOGOSTYLE=classic
115+
```
116+
117+
If you have `logoStyle: modern` set, override files in `modern-logo/` instead!
118+
119+
### Example: Complete Branding Customization
120+
121+
To fully rebrand Stirling-PDF with your company logo, override multiple variants:
122+
123+
```bash
124+
customFiles/
125+
└── static/
126+
├── favicon.svg # Main favicon
127+
├── favicon.ico # Legacy favicon
128+
└── classic-logo/ # Or modern-logo/ if using modern style
129+
├── StirlingPDFLogoBlackText.svg # Light mode with text
130+
├── StirlingPDFLogoWhiteText.svg # Dark mode with text
131+
├── StirlingPDFLogoNoTextLight.svg # Light mode icon only
132+
├── StirlingPDFLogoNoTextDark.svg # Dark mode icon only
133+
├── logo-tooltip.svg # Small icon
134+
├── favicon.ico # Style-specific favicon
135+
└── Firstpage.png # Homepage preview
136+
```
137+
138+
**Important:** Set your logo style to match the directory:
139+
```yaml
140+
ui:
141+
logoStyle: classic # Use 'classic' if overriding classic-logo/, 'modern' if overriding modern-logo/
142+
```
143+
144+
Or via environment variable: `UI_LOGOSTYLE=classic`
145+
146+
**Tips:**
147+
- For consistent branding across light/dark modes, provide both:
148+
- `StirlingPDFLogoBlackText.svg` (shows on light backgrounds)
149+
- `StirlingPDFLogoWhiteText.svg` (shows on dark backgrounds)
150+
- You can also configure this in-app: Settings → UI → Logo Style (if you have login enabled)
151+
152+
### Advanced: Overriding Built Files (HTML, JS, CSS)
153+
154+
**⚠️ For developers only!**
155+
156+
Files like `index.html`, JavaScript bundles, and CSS are **generated** by the build process from `frontend/src/`. To override these:
157+
158+
1. Clone the Stirling-PDF repository
159+
2. Make your changes to the React source code in `frontend/src/`
160+
3. Build the frontend: `npm run build` (from the `frontend/` directory)
161+
4. The built files appear in `frontend/dist/`
162+
5. Copy the specific files you want to override to `customFiles/static/` matching the path structure
163+
164+
**Example:** To override `index.html`:
165+
```bash
166+
# After building the frontend
167+
cp frontend/dist/index.html customFiles/static/index.html
168+
```
169+
170+
**Warning:** Built files may include hashed filenames (e.g., `assets/index-abc123.js`) that change with each build. Overriding these requires matching the exact filename from your build and is not recommended for most users.
171+
172+
---
173+
174+
## Defaulting Language
9175
Default language selection via the `SYSTEM_DEFAULTLOCALE` environment variable. Accepted values include `de-DE`, `fr-FR`, `ar-AR` and all other languages codes that are within Stirling-PDFs current list.
10176

11-
### Google Search Visibility (robots.txt)
177+
## Google Search Visibility (robots.txt)
12178
Enable or disable search engine visibility with the `ALLOW_GOOGLE_VISIBILITY` variable.
13179

14-
### Custom Root path
180+
## Custom Root path
15181
Redirect the root path of the application using `APP_ROOT_PATH`.
16182
This is for changing websites like stirlingtools.com to instead host the interface at stirlingtools.com/`APP_ROOT_PATH` like stirlingtools.com/demo
17183

18-
### Enable/Disable Analytics
184+
## Enable/Disable Analytics
19185
Analytics can be enabled/disabled with ``SYSTEM_ENABLEANALYTICS`` or
20186
```yaml
21187
system:

docs/Configuration/UI Customisation.md

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ These settings (in Settings.yml) control system behavior and customization capab
2020
- `showUpdate` - Controls whether update notifications are displayed
2121
- `showUpdateOnlyAdmin` - When true, restricts update notifications to admin users only (requires `showUpdate: true`)
2222

23-
## V2.0 UI Customization Notes
23+
## UI Customization Options
2424

25-
### In-App Settings Management (V2.0+)
25+
### In-App Settings Management (Recommended)
2626

27-
**New in V2.0**: If you have login enabled and are logged in as an admin, you can now configure all settings directly in the application through the **Settings** menu. No need to edit `settings.yml` manually!
27+
If you have login enabled and are logged in as an admin, you can configure all settings directly in the application through the **Settings** menu. No need to edit `settings.yml` manually!
2828

2929
**How to access:**
3030
1. Enable login: `SECURITY_ENABLELOGIN=true`
@@ -33,36 +33,44 @@ These settings (in Settings.yml) control system behavior and customization capab
3333
4. Configure all options through the UI
3434
5. Changes apply immediately
3535

36-
This is the recommended way to manage settings in V2.0 for production deployments.
36+
**Available customizations:**
37+
- Application name and branding
38+
- Update notification settings
39+
- Language settings
40+
- Theme preferences
41+
- Logo style (classic/modern)
42+
- Custom logo upload
3743

38-
### Template Customization Changes
44+
### Static File Overrides (Advanced)
3945

40-
**Important**: The V1 `customFiles/` folder system for overriding templates has been replaced with a new customization approach due to the UI framework change in V2.0.
46+
For customization beyond the built-in settings, you can override static files like logos, favicons, and images:
4147

42-
For advanced UI customization in V2.0:
43-
1. Clone or download the repository
44-
2. Modify the React components in the `frontend/src` directory
45-
3. Build the frontend: `cd frontend && npm install && npm run build`
46-
4. Volume mount the `frontend/dist` folder into your Docker container to replace the built-in frontend files
47-
48-
Example docker-compose with custom frontend:
4948
```yaml
5049
services:
5150
stirling-pdf:
5251
image: stirlingtools/stirling-pdf:latest
5352
ports:
5453
- '8080:8080'
5554
volumes:
56-
- ./frontend/dist:/app/frontend/dist # Mount your custom frontend
57-
environment:
58-
- MODE=BOTH
55+
- ./customFiles:/customFiles:rw
5956
```
6057
61-
The following customizations work without rebuilding:
62-
- Application name and branding (via environment variables or in-app settings)
63-
- Update notification settings (via in-app settings if admin)
64-
- Language settings (via in-app settings)
65-
- Theme preferences (via in-app settings)
58+
Then place your custom files in `customFiles/static/` matching the path structure. Common examples:
59+
- `customFiles/static/favicon.svg` - Custom favicon
60+
- `customFiles/static/classic-logo/logo.svg` - Custom logo
61+
- `customFiles/static/modern-logo/logo.svg` - Custom modern logo
62+
63+
**Learn more:** [Other Customisations - Static File Overrides](./Other%20Customisations.md#static-file-overrides)
64+
65+
### Fork the Frontend (Developers)
66+
67+
For complete UI customization:
68+
1. Clone the Stirling-PDF repository
69+
2. Modify the React components in `frontend/src/`
70+
3. Build the frontend: `cd frontend && npm install && npm run build`
71+
4. Use static file overrides or build your own Docker image
72+
73+
This approach requires maintaining your fork and manually merging updates.
6674

6775
## Configuration Examples
6876

docs/Installation/Path Structure.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ All paths below are relative to the BASE_PATH. The File.separator ensures cross-
3232
- `pipeline/finishedFolders/` - Completed processing output location
3333

3434
## Custom Files Structure
35-
- `customFiles/static/` - Static assets
36-
- `customFiles/templates/` - Template files
35+
- `customFiles/static/` - Static asset overrides (logos, images, favicons, etc.)
36+
- `customFiles/templates/` - Legacy template files (deprecated, not used)
3737
- `customFiles/signatures/` - Digital signature files
3838

docs/Migration/Breaking-Changes.md

Lines changed: 40 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,34 @@ Most V1 deployments will upgrade smoothly to V2, but there are some important ch
2222

2323
---
2424

25-
## 🎨 Template Customization System Removed
25+
## 🎨 UI Customization Architecture Changed
2626

2727
**Impact:** HIGH for users who customized UI using `customFiles/templates/`
2828

2929
### What Changed
3030

31-
**V1 Approach:**
31+
**V1 Architecture:**
3232
```bash
3333
customFiles/
3434
└── templates/
3535
├── fragments/
36-
│ └── navbar.html # Custom navbar
37-
└── home.html # Custom homepage
36+
│ └── navbar.html # Custom Thymeleaf template
37+
└── home.html # Custom Thymeleaf template
3838
```
3939

40-
V1 used server-side template injection with Thymeleaf templates.
40+
V1 used **server-side rendering** with Thymeleaf templates. HTML was generated dynamically on the server for each request.
4141

42-
**V2 Approach:**
43-
V2 uses React frontend - server-side template injection no longer possible.
42+
**V2 Architecture:**
43+
V2 uses a **React frontend** with client-side rendering. The UI is built into **static files** (HTML, CSS, JavaScript) that are served to the browser.
44+
45+
**What this means:**
46+
- ❌ Thymeleaf templates (`.html` with `th:*` attributes) no longer work because there's no server-side rendering
47+
- ✅ Static file overrides **still work** via `customFiles/static/` - same concept, different paths
48+
- The file paths are different because they're now built React files instead of Thymeleaf templates
4449

4550
### Migration Path
4651

47-
If you customized templates in V1, you have two options:
52+
Your V1 Thymeleaf templates cannot be directly reused in V2, but you have three options:
4853

4954
#### Option 1: Use Built-In Customization (Recommended)
5055

@@ -65,26 +70,35 @@ V2 provides in-app settings for most common customizations:
6570

6671
**Learn more:** [UI Customisation](../Configuration/UI%20Customisation.md)
6772

68-
#### Option 2: Edit Static Files in Docker
73+
#### Option 2: Static File Overrides (Same Concept as V1, Different Paths)
6974

70-
For customizations beyond built-in settings, you can mount and edit static files:
75+
**✅ Still supported in V2!** The static file override system works the same way conceptually - place files in `customFiles/static/` to override defaults.
7176

72-
**Steps:**
73-
1. Mount the `/customFiles/static/` directory in Docker
74-
2. Add your custom static files (images, favicons, etc.)
75-
3. Reference them in your HTML/settings
76-
4. Restart container to apply changes
77+
**How it works:**
78+
1. V2 checks `customFiles/static/` **first** for any requested file
79+
2. If not found, falls back to the bundled static files
80+
3. This lets you override logos, CSS, HTML, JavaScript, or any other static asset
7781

7882
**Example Docker compose:**
7983
```yaml
8084
volumes:
8185
- ./customFiles:/customFiles:rw
8286
```
8387
88+
**Key difference from V1:**
89+
- V1 paths: `customFiles/templates/fragments/navbar.html` (Thymeleaf)
90+
- V2 paths: `customFiles/static/index.html` (React build output)
91+
92+
The file paths are different because V2 serves the **compiled React app** instead of Thymeleaf templates. See [Other Customisations - Static File Overrides](../Configuration/Other%20Customisations.md#static-file-overrides) for:
93+
- How to determine the correct file paths in V2
94+
- Examples of common customizations
95+
- Understanding the build output structure
96+
8497
**Use cases:**
85-
- Custom favicon
86-
- Custom images/logos
87-
- Static assets
98+
- Custom favicon or logo
99+
- Modified `index.html` for advanced branding
100+
- Custom CSS to override styles
101+
- Additional static assets
88102

89103
#### Option 3: Fork the Frontend (Advanced)
90104

@@ -103,21 +117,25 @@ For complete UI customization:
103117

104118
### What No Longer Works
105119

106-
These V1 customization patterns are **no longer supported:**
120+
These V1 **Thymeleaf template features** no longer work because V2 uses React (client-side) instead of Thymeleaf (server-side):
107121

108122
```html
109-
<!-- V1: Inject custom navbar (NO LONGER WORKS) -->
123+
<!-- V1: Thymeleaf fragment injection (NO LONGER WORKS) -->
110124
<div th:replace="fragments/navbar :: navbar"></div>
111125
112-
<!-- V1: Conditional content (NO LONGER WORKS) -->
126+
<!-- V1: Thymeleaf conditionals (NO LONGER WORKS) -->
113127
<div th:if="${@propertyService.get('ui.showAdvanced')}">
114128
Custom content
115129
</div>
116130
117-
<!-- V1: Server-side variables (NO LONGER WORKS) -->
131+
<!-- V1: Thymeleaf variables (NO LONGER WORKS) -->
118132
<span th:text="${appName}"></span>
119133
```
120134

135+
**Why they don't work:** These are Thymeleaf-specific features that require server-side HTML generation. V2 uses React which compiles to static JavaScript that runs in the browser.
136+
137+
**Alternative:** You can still customize the **output** by overriding the built static files in `customFiles/static/`, but you'll be editing the compiled HTML/CSS/JS instead of Thymeleaf templates.
138+
121139
---
122140

123141
## ⚙️ UI Settings Moved to In-App Configuration

0 commit comments

Comments
 (0)