Skip to content

Commit 5e13074

Browse files
committed
Added: Minify plugin, rename argument to docs-dir
1 parent e37ac08 commit 5e13074

File tree

5 files changed

+40
-14
lines changed

5 files changed

+40
-14
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,3 +351,6 @@ MigrationBackup/
351351

352352
# Python virtual environments
353353
venv/
354+
355+
# MkDocs build output
356+
site/

docs/Pages/index.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,24 @@ plugins:
7575
file_types_to_check: [ "psd", "7z", "kra" ]
7676
file_types_override_mode: append
7777
enabled: true
78+
- minify:
79+
minify_html: true
80+
minify_js: true
81+
minify_css: true
82+
htmlmin_opts:
83+
remove_comments: true
84+
cache_safe: true
7885
- exclude:
7986
# Exclude the Theme's own files.
8087
glob:
81-
- Reloaded/docs/Pages/*
82-
- Reloaded/docs/docs/*
83-
- Reloaded/docs/Readme.md
84-
- Reloaded/docs/LICENSE
85-
- Reloaded/docs/mkdocs.yml
88+
- Reloaded/docs/Pages/index.md
89+
- Reloaded/docs/Pages/testing-zone.md
90+
- Reloaded/.gitignore
91+
- Reloaded/Readme.md
92+
- Reloaded/LICENSE
93+
- Reloaded/*.yml
94+
- Reloaded/*.py
95+
- Reloaded/venv/*
8696

8797
nav:
8898
- Home: index.md

docs/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
mkdocs-material
22
mkdocs-redirects
33
mkdocs-exclude-unused-files
4-
mkdocs-exclude
4+
mkdocs-exclude
5+
mkdocs-minify-plugin

mkdocs.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ theme:
4747
plugins:
4848
- offline
4949
- search
50+
- minify:
51+
minify_html: true
52+
minify_js: true
53+
minify_css: true
54+
htmlmin_opts:
55+
remove_comments: true
56+
cache_safe: true
5057
- redirects:
5158
redirect_maps:
5259
"index.md": "Pages/index.md"

start_docs.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ def main():
2323
import argparse
2424

2525
parser = argparse.ArgumentParser(description='Set up documentation environment')
26-
parser.add_argument('--target-dir', type=str, help='Target directory for documentation (default: script directory)')
26+
parser.add_argument('--docs-dir', type=str, help='Documentation directory containing mkdocs.yml and docs/ subfolder (default: script directory)')
2727
parser.add_argument('--project-name', type=str, default='documentation', help='Project name for messages')
2828
args = parser.parse_args()
2929

30-
# Use target directory if provided, otherwise use script directory
31-
if args.target_dir:
32-
script_dir = Path(args.target_dir)
30+
# Use docs directory if provided, otherwise use script directory
31+
if args.docs_dir:
32+
script_dir = Path(args.docs_dir)
3333
else:
3434
script_dir = Path(__file__).parent
3535

@@ -54,14 +54,19 @@ def main():
5454

5555
# Install required packages
5656
print("Installing required packages...")
57-
# Install from requirements.txt first
57+
58+
# Install from requirements.txt relative to this script if it exists
59+
script_requirements_file = Path(__file__).parent / "docs" / "requirements.txt"
60+
if script_requirements_file.exists():
61+
print(f"Installing from {script_requirements_file}...")
62+
run_command([str(pip_exe), "install", "-r", str(script_requirements_file)], cwd=script_dir)
63+
64+
# Install from requirements.txt in docs directory if it exists
5865
requirements_file = script_dir / "docs" / "requirements.txt"
5966
if requirements_file.exists():
67+
print(f"Installing from {requirements_file}...")
6068
run_command([str(pip_exe), "install", "-r", str(requirements_file)], cwd=script_dir)
6169

62-
# Install mkdocs-material separately
63-
run_command([str(pip_exe), "install", "mkdocs-material"], cwd=script_dir)
64-
6570
# Start MkDocs live server
6671
print("Starting MkDocs live server...")
6772
print("Documentation will be available at http://127.0.0.1:8000 (paste into browser address bar)")

0 commit comments

Comments
 (0)