Style updates, doc updates
This commit is contained in:
parent
1ef77413db
commit
8e1bedf9ec
38
README.md
38
README.md
@ -14,18 +14,46 @@ Therefore, `la sampu cu sampu lo ka samtci`!
|
|||||||
|
|
||||||
- [Haskell](https://www.haskell.org)
|
- [Haskell](https://www.haskell.org)
|
||||||
- [Twain](https://github.com/alexmingoia/twain)
|
- [Twain](https://github.com/alexmingoia/twain)
|
||||||
- [Lucid2](https://chrisdone.com/posts/lucid2)
|
- [Lucid](https://github.com/chrisdone/lucid)
|
||||||
|
- [Clay](https://github.com/sebastiaanvisser/clay)
|
||||||
|
|
||||||
## Goal
|
## Goal
|
||||||
|
|
||||||
Provide a simple blog engine that is easily customizable via HTML fragments.
|
Provide a simple blog engine that is easily customizable via HTML fragments.
|
||||||
|
|
||||||
## Deployment
|
## Build and Deployment
|
||||||
|
|
||||||
We're not there yet! This project is built and packaged with Nix,
|
Only Nix build instructions are provided below.
|
||||||
so I will provide directions on deploying with Nix as well as via OCI
|
|
||||||
containers once there's something viable to run.
|
|
||||||
|
|
||||||
|
### No Containers
|
||||||
|
1) Clone this repository
|
||||||
|
2) Build the application (with flakes enabled): `nix build '.#'`
|
||||||
|
3) Set the environment variables
|
||||||
|
- File: `cp data/.env.example ./.env; $EDITOR ./.env`
|
||||||
|
- If you want to set them in a different way, you already know how.
|
||||||
|
4) Run the application: `./result/bin/sampu`
|
||||||
|
|
||||||
|
### Containers
|
||||||
|
|
||||||
|
1) Clone this repository
|
||||||
|
2) Build the container image (with flakes enabled): `nix build .#sampu-container`
|
||||||
|
3) Load the container image: `podman load -i result`
|
||||||
|
4) Run the container using your favorite orchestrator or...
|
||||||
|
5) Use a NixOS configuration:
|
||||||
|
```
|
||||||
|
virtualisation.oci-containers.containers.sampu = {
|
||||||
|
image = "sampu";
|
||||||
|
ports = [ "${SAMPUR_EXTERNAL_PORT}:3000" ];
|
||||||
|
volumes = [
|
||||||
|
"/PATH/TO/SAMPU/data:/app/data"
|
||||||
|
];
|
||||||
|
environment = {
|
||||||
|
SAMPU_PORT = "3000";
|
||||||
|
SAMPU_TITLE = "Your Blog Title Here!";
|
||||||
|
SAMPU_BASEURL = "http://example.public.tld";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
```
|
||||||
## Development and Support
|
## Development and Support
|
||||||
|
|
||||||
Per the permissive ISC license, you are free to do what you wish with this
|
Per the permissive ISC license, you are free to do what you wish with this
|
||||||
|
0
data/assets/public/test
Normal file
0
data/assets/public/test
Normal file
@ -1,6 +1,6 @@
|
|||||||
cabal-version: 3.0
|
cabal-version: 3.0
|
||||||
name: sampu
|
name: sampu
|
||||||
version: 0.6.0
|
version: 0.7.0
|
||||||
license: ISC
|
license: ISC
|
||||||
author: James Eversole
|
author: James Eversole
|
||||||
maintainer: james@eversole.co
|
maintainer: james@eversole.co
|
||||||
@ -28,6 +28,7 @@ executable sampu
|
|||||||
, time >= 1.12.0
|
, time >= 1.12.0
|
||||||
, twain >= 2.1.0.0
|
, twain >= 2.1.0.0
|
||||||
, wai-extra >= 3.0 && < 3.2
|
, wai-extra >= 3.0 && < 3.2
|
||||||
|
, wai-middleware-static >= 0.9.0
|
||||||
, warp == 3.3.25
|
, warp == 3.3.25
|
||||||
, xml-conduit >= 1.9.1.0
|
, xml-conduit >= 1.9.1.0
|
||||||
hs-source-dirs: src
|
hs-source-dirs: src
|
||||||
|
@ -7,6 +7,7 @@ import Control.Monad ( mapM_ )
|
|||||||
import Data.String ( fromString )
|
import Data.String ( fromString )
|
||||||
import Network.Wai.Handler.Warp ( Port, run )
|
import Network.Wai.Handler.Warp ( Port, run )
|
||||||
import Network.Wai.Middleware.RequestLogger ( logStdout, logStdoutDev )
|
import Network.Wai.Middleware.RequestLogger ( logStdout, logStdoutDev )
|
||||||
|
import Network.Wai.Middleware.Static ( staticPolicy, noDots, addBase, (>->) )
|
||||||
import System.FilePath ( takeFileName )
|
import System.FilePath ( takeFileName )
|
||||||
|
|
||||||
|
|
||||||
@ -24,7 +25,9 @@ main postNames = do
|
|||||||
|
|
||||||
-- These Middlewares are executed before any routes are reached.
|
-- These Middlewares are executed before any routes are reached.
|
||||||
preProcessors :: [Middleware]
|
preProcessors :: [Middleware]
|
||||||
preProcessors = [logStdoutDev]
|
preProcessors = [ logStdoutDev
|
||||||
|
, staticPolicy (noDots >-> addBase "data/assets/public")
|
||||||
|
]
|
||||||
|
|
||||||
-- These Middlewares are executed after all other routes are exhausted
|
-- These Middlewares are executed after all other routes are exhausted
|
||||||
postProcessors :: [Middleware]
|
postProcessors :: [Middleware]
|
||||||
|
@ -17,15 +17,16 @@ composedStyles :: Css
|
|||||||
composedStyles = do
|
composedStyles = do
|
||||||
core_
|
core_
|
||||||
main_
|
main_
|
||||||
|
nav_
|
||||||
notFound_
|
notFound_
|
||||||
postList_
|
postList_
|
||||||
nav_
|
|
||||||
mobileFriendly_
|
mobileFriendly_
|
||||||
|
|
||||||
core_ :: Css
|
core_ :: Css
|
||||||
core_ = do
|
core_ = do
|
||||||
a_
|
a_
|
||||||
body_
|
body_
|
||||||
|
code_
|
||||||
footer_
|
footer_
|
||||||
html_
|
html_
|
||||||
p_
|
p_
|
||||||
@ -39,11 +40,14 @@ a_ = do
|
|||||||
body_ :: Css
|
body_ :: Css
|
||||||
body_ = do
|
body_ = do
|
||||||
body ? do
|
body ? do
|
||||||
fontFamily [] [monospace]
|
display flex
|
||||||
fontSize $ em 1.25
|
minHeight $ vh 100
|
||||||
fontWeight $ weight 300
|
flexDirection column
|
||||||
textAlign start
|
fontFamily [] [monospace]
|
||||||
margin (em 0) auto (em 0) auto
|
fontSize $ em 1.25
|
||||||
|
fontWeight $ weight 300
|
||||||
|
textAlign start
|
||||||
|
margin (em 0) auto (em 0) auto
|
||||||
strong ? do
|
strong ? do
|
||||||
fontWeight $ weight 600
|
fontWeight $ weight 600
|
||||||
li ? do
|
li ? do
|
||||||
@ -52,11 +56,10 @@ body_ = do
|
|||||||
footer_ :: Css
|
footer_ :: Css
|
||||||
footer_ = do
|
footer_ = do
|
||||||
footer ? do
|
footer ? do
|
||||||
position absolute
|
|
||||||
margin (em 0) (em 0) (em 0) (em 0)
|
|
||||||
bottom (em 0)
|
bottom (em 0)
|
||||||
|
margin auto (em 0) (em 0) (em 0)
|
||||||
width $ pct 100
|
width $ pct 100
|
||||||
backgroundColor $ rgba 109 146 173 0.3
|
backgroundColor terColor
|
||||||
textAlign center
|
textAlign center
|
||||||
padding (em 1) (em 0) (em 1) (em 0)
|
padding (em 1) (em 0) (em 1) (em 0)
|
||||||
boxSizing borderBox
|
boxSizing borderBox
|
||||||
@ -76,13 +79,14 @@ html_ = do
|
|||||||
p_ :: Css
|
p_ :: Css
|
||||||
p_ = do
|
p_ = do
|
||||||
p ? do
|
p ? do
|
||||||
margin (em 0.4) (em 0) (em 0.4) (em 0)
|
margin (em 1) (em 0) (em 0.6) (em 0)
|
||||||
|
|
||||||
main_ :: Css
|
main_ :: Css
|
||||||
main_ = do
|
main_ = do
|
||||||
".main" ? do
|
".main" ? do
|
||||||
margin (em 0) auto (em 0) auto
|
margin (em 0) auto (em 0) auto
|
||||||
maxWidth $ pct 60
|
maxWidth $ pct 60
|
||||||
|
minWidth $ pct 40
|
||||||
|
|
||||||
notFound_ :: Css
|
notFound_ :: Css
|
||||||
notFound_ = do
|
notFound_ = do
|
||||||
@ -97,7 +101,18 @@ notFound_ = do
|
|||||||
postList_ :: Css
|
postList_ :: Css
|
||||||
postList_ = do
|
postList_ = do
|
||||||
".postList" ? do
|
".postList" ? do
|
||||||
|
margin (em 0) auto (em 0) auto
|
||||||
fontSize (em 1.5)
|
fontSize (em 1.5)
|
||||||
|
minWidth (pct 60)
|
||||||
|
maxWidth (pct 95)
|
||||||
|
overflow scroll
|
||||||
|
|
||||||
|
code_ :: Css
|
||||||
|
code_ = do
|
||||||
|
code ? do
|
||||||
|
color priColor
|
||||||
|
backgroundColor terColor
|
||||||
|
overflowX scroll
|
||||||
|
|
||||||
nav_ :: Css
|
nav_ :: Css
|
||||||
nav_ = do
|
nav_ = do
|
||||||
@ -107,7 +122,7 @@ nav_ = do
|
|||||||
textAlign center
|
textAlign center
|
||||||
".mainNav" ? do
|
".mainNav" ? do
|
||||||
margin (em 0) auto (em 0) auto
|
margin (em 0) auto (em 0) auto
|
||||||
padding (em 0) (em 0) (em 0) (em 0)
|
padding (em 0.5) (em 0.5) (em 0.5) (em 0.5)
|
||||||
overflow hidden
|
overflow hidden
|
||||||
boxShadow . pure $ bsColor "#ccc" $ shadowWithBlur (px 4) (px 4) (px 6)
|
boxShadow . pure $ bsColor "#ccc" $ shadowWithBlur (px 4) (px 4) (px 6)
|
||||||
display inlineFlex
|
display inlineFlex
|
||||||
|
@ -37,9 +37,9 @@ basePost :: Html () -> Html ()
|
|||||||
basePost content = div_ [class_ "main"] content
|
basePost content = div_ [class_ "main"] content
|
||||||
|
|
||||||
postIndex :: [FilePath] -> Html ()
|
postIndex :: [FilePath] -> Html ()
|
||||||
postIndex postNames = div_ [class_ "main"] $ do
|
postIndex postNames = div_ [class_ "postList"] $ do
|
||||||
h1_ [class_ "title"] "All Posts"
|
h1_ [class_ "title"] "All Posts"
|
||||||
ul_ [class_ "postList"] $ do
|
ul_ [] $ do
|
||||||
mapM_
|
mapM_
|
||||||
(\x -> li_ $ a_ [href_ (pack $ "/posts/" ++ x)] (fromString x))
|
(\x -> li_ $ a_ [href_ (pack $ "/posts/" ++ x)] (fromString x))
|
||||||
postNames
|
postNames
|
||||||
|
Loading…
x
Reference in New Issue
Block a user