https://github.com/swlkr/speakeasy
A static site generator written in janet
https://github.com/swlkr/speakeasy
Last synced: 9 months ago
JSON representation
A static site generator written in janet
- Host: GitHub
- URL: https://github.com/swlkr/speakeasy
- Owner: swlkr
- License: mit
- Created: 2020-10-09T21:07:41.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-09T21:14:05.000Z (over 5 years ago)
- Last Synced: 2025-03-26T06:11:19.144Z (10 months ago)
- Language: Clojure
- Size: 17.6 KB
- Stars: 13
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# speakeasy
Speakeasy is a static site generator written in [janet](https://github.com/janet-lang/janet)
## Installation
Make sure you have `janet` installed first:
```sh
brew install janet
```
[Find other installation instructions here](https://janet-lang.org/docs/index.html)
Then use `jpm` the janet package manager to install `speakeasy`
```sh
jpm install https://github.com/swlkr/speakeasy
```
Add speakeasy to your `$PATH` (on macOS with homebrew):
```sh
export PATH=/usr/local/Cellar/janet//bin:$PATH
```
## Quick Start
Create an `index.janet` file:
```clojure
# index.janet
[(doctype :html5)
[:html
[:head
[:title "Prohibition ends here. Have a drink."]]
[:body
[:h1 "Welcome to the speakeasy. No snitches allowed."]]]]
```
Run speakeasy in that same directory as the `index.janet` file above:
```sh
speakeasy
# 1 html file generated
```
With any luck, the `index.janet` file above should have turned into an `index.html` file that looks like this (except it's all on one line):
```html
Prohibition ends here. Have a drink.
Welcome to the speakeasy. No snitches allowed.
```
The sky is the limit with speakeasy, organize your files however you want, `smuggle` in other files and reference functions anywhere:
```clojure
# layout.janet
(defn layout [& body]
[(doctype :html5)
[:html
[:head
[:title "Prohibition ends here. Have a drink."]]
[:body body]]])
```
Then in `index.janet`:
```clojure
# index.janet
(smuggle ./layout)
(layout
[:h1 "Welcome to the speakeasy. No snitches allowed."])
```
Speakeasy's html syntax works great with atomic css frameworks like [tailwind.css](https://tailwindcss.com):
```clojure
# layout.janet
(defn layout [& body]
[(doctype :html5)
[:html
[:head
[:title "Prohibition ends here. Have a drink."]
[:link {:href "/tailwind.min.css" :rel "stylesheet"}]]
[:body body]]])
```
Create a new file, `html.janet`:
```clojure
# html.janet
(def h1 :h1.text-5xl.text-gray-800)
```
Then over in `index.janet`:
```clojure
# index.janet
(smuggle ./layout)
(smuggle ./html)
(layout
[h1 "Welcome to the speakeasy. No snitches allowed."])
```
Run speakeasy one more time:
```sh
speakeasy
```
Now `index.html` should look like this:
```html
Prohibition ends here. Have a drink.
Welcome to the speakeasy. No snitches allowed.
```
Happy hacking!