Skip to content

Commit 2d8822e

Browse files
committed
Initial commit: Eden static site generator
Eden is a Clojure-based static site generator with EDN-first content, Hiccup templates, and MCP (Model Context Protocol) support for AI assistance. Features: - Content-driven architecture with EDN and Markdown - Multi-language support with built-in i18n - Hiccup-style templates with powerful directives - Smart dependency tracking for efficient builds - Asset bundling with esbuild integration - Image processing with dynamic resizing - MCP server for AI-assisted content management - Comprehensive test suite with reflection checking Project structure: - Core build pipeline with modular steps - Template system with :eden/* directives - Content loader supporting EDN and Markdown - MCP integration for AI tools - Full test coverage (71 tests, 531 assertions) Includes complete documentation, example site template, development tools with file watching and browser-sync, production-ready build system, and type hints for reflection-free performance.
0 parents  commit 2d8822e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+9786
-0
lines changed

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
node_modules/
2+
public/
3+
.DS_Store
4+
*.log
5+
.nrepl-port
6+
.cpcache/
7+
out/
8+
.temp/
9+
dist/
10+
.clojure-mcp/
11+
coverage/
12+
CLAUDE.md
13+
llm/
14+

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Anteo AS
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Eden
2+
3+
Static sites from EDN and Markdown.
4+
5+
Eden is a Clojure static site generator designed for content-driven websites.
6+
7+
## Features
8+
9+
- **Content-driven**: Write content in EDN or Markdown with EDN frontmatter
10+
- **Multi-language support**: Built-in internationalization with translations
11+
- **Flexible templates**: Hiccup-style templates with powerful directives
12+
- **Smart dependency tracking**: Only builds pages that are linked
13+
- **Modern asset pipeline**: CSS/JS bundling with esbuild (when available)
14+
- **Image processing**: Resize images with query parameters
15+
- **Developer friendly**: File watching, browser-sync, and build reports
16+
17+
## Quick Start
18+
19+
```bash
20+
# Install Eden as a tool
21+
clj -Ttools install io.github.anteoas/eden \
22+
'{:git/url "https://github.com/anteoas/eden.git" :git/tag "v1.0.0"}' \
23+
:as eden
24+
25+
# Create and initialize a new site
26+
mkdir my-site
27+
cd my-site
28+
clj -Teden init
29+
30+
# Start development server
31+
npm run dev
32+
33+
# Build for production
34+
npm run build
35+
```
36+
37+
## Project Structure
38+
39+
```
40+
my-site/
41+
├── site.edn # Site configuration
42+
├── templates/ # Hiccup templates
43+
│ ├── base.edn # HTML wrapper
44+
│ └── home.edn # Page templates
45+
├── content/ # Content files
46+
│ └── en/ # English content
47+
│ ├── home.edn # Homepage content
48+
│ └── strings.edn # Translations
49+
├── assets/ # Static assets
50+
│ ├── css/ # Stylesheets
51+
│ ├── js/ # JavaScript
52+
│ └── images/ # Images
53+
└── dist/ # Build output (generated)
54+
```
55+
56+
## Template Directives
57+
58+
Eden templates use special directives for dynamic content:
59+
60+
- `:eden/body` - Insert page content
61+
- `:eden/get` - Retrieve values from context
62+
- `:eden/get-in` - Access nested data
63+
- `:eden/each` - Iterate over collections
64+
- `:eden/if` - Conditional rendering
65+
- `:eden/link` - Smart page linking
66+
- `:eden/render` - Render components
67+
- `:eden/t` - Translations with interpolation
68+
- `:eden/with` - Merge data into context
69+
- `:eden/include` - Include other templates
70+
71+
## Configuration
72+
73+
Configure your site in `site.edn`:
74+
75+
```clojure
76+
{:wrapper :base ; HTML wrapper template
77+
:index :home ; Homepage template
78+
:render-roots #{:home} ; Starting pages (dependencies auto-discovered)
79+
:url-strategy :nested ; :flat for page.html, :nested for page/index.html
80+
:lang {:en {:name "English"
81+
:default true}}}
82+
```
83+
84+
## MCP Integration (Coming Soon)
85+
86+
Eden will include Model Context Protocol (MCP) support, allowing AI assistants like Claude to help manage site content. This feature is currently under development.
87+
88+
## Documentation
89+
90+
- [Getting Started Guide](docs/getting-started.md) - Quick start and basic usage
91+
- [Template Reference](docs/reference.md) - Complete directive and configuration reference
92+
- [Internals Guide](docs/internals.md) - Architecture and implementation details
93+
94+
## License
95+
96+
Copyright © 2025
97+
98+
Distributed under the Eclipse Public License version 2.0.

deps.edn

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{:paths ["src" "resources"]
2+
:deps {org.clojure/clojure {:mvn/version "1.12.1"}
3+
markdown-clj/markdown-clj {:mvn/version "1.11.4"}
4+
no.cjohansen/replicant {:mvn/version "2025.06.21"}
5+
babashka/fs {:mvn/version "0.4.19"}
6+
org.babashka/sci {:mvn/version "0.10.47"}
7+
org.clojure/data.json {:mvn/version "2.5.0"}
8+
9+
;; Image processing dependencies
10+
org.imgscalr/imgscalr-lib {:mvn/version "4.2"}
11+
12+
;; File watching
13+
io.github.anteoas/hawkeye {:git/tag "v2025.08.19" :git/sha "8ea8b19"}
14+
15+
;; MCP Server dependencies
16+
ring/ring-core {:mvn/version "1.12.1"}
17+
ring/ring-jetty-adapter {:mvn/version "1.12.1"}
18+
ring/ring-json {:mvn/version "0.5.1"}
19+
20+
;; SLF4J no-op implementation to suppress warnings
21+
org.slf4j/slf4j-nop {:mvn/version "2.0.9"}}
22+
23+
;; Tool configuration for installation
24+
:tools/usage {:ns-default eden.core
25+
:exec-fn eden.core/help
26+
:jvm-opts ["--enable-native-access=ALL-UNNAMED"]}
27+
28+
:aliases {:run {:main-opts ["-m" "eden.core"]}
29+
:dev {:extra-paths ["dev"]
30+
:extra-deps {djblue/portal #_{:clj-kondo/ignore [:deps.edn]} {:mvn/version "RELEASE"}}}
31+
:build {:exec-fn eden.core/build
32+
:exec-args {:site-edn "site/site.edn"}}
33+
:serve {:exec-fn eden.core/dev
34+
:exec-args {:site-edn "site/site.edn"}
35+
:jvm-opts ["--enable-native-access=ALL-UNNAMED"]}
36+
:clean {:exec-fn eden.core/clean}
37+
:test {:extra-paths ["test"]
38+
:extra-deps {lambdaisland/kaocha {:mvn/version "1.91.1392"}}
39+
:main-opts ["-m" "kaocha.runner"]}
40+
:nrepl {:extra-deps {nrepl/nrepl {:mvn/version "1.3.1"}}
41+
:jvm-opts ["-Djdk.attach.allowAttachSelf"]
42+
:main-opts ["-m" "nrepl.cmdline"]}}}

dev/user.clj

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
(ns user
2+
(:require [eden.core]
3+
[clojure.datafy]))
4+
5+
(defmacro capture-env
6+
"Capture local bindings.
7+
8+
Example:
9+
10+
(defn adder [x y]
11+
(user/capture-env)
12+
(+ x y))
13+
14+
expands to:
15+
16+
(defn adder [x y]
17+
(def x x)
18+
(def y y)
19+
(+ x y))
20+
21+
you can also specify which symbols to capture
22+
23+
(defn adder [x y]
24+
(user/capture-env y)
25+
(+ x y))
26+
27+
expands to:
28+
29+
(defn adder [x y]
30+
(def y y)
31+
(+ x y))
32+
33+
34+
Useful for debugging function bodies in the repl."
35+
([]
36+
`(capture-env ~@(keys &env)))
37+
([& symbols]
38+
(cons 'do
39+
(map (fn [local]
40+
`(def ~local ~local))
41+
symbols))))
42+
43+
(when-let [open (requiring-resolve 'portal.api/open)]
44+
(let [selected (requiring-resolve 'portal.api/selected)
45+
submit (comp (requiring-resolve 'portal.api/submit) clojure.datafy/datafy)]
46+
47+
(defonce p (open {:theme :portal.colors/gruvbox :name "website"}))
48+
(defonce _add-tap-only-once (add-tap submit))
49+
(defn selected [] (selected p))
50+
(defn popen [] (open p))))

0 commit comments

Comments
 (0)