shikensu
v1.0.0
Published
Run a sequence of functions on in-memory representations of files
Downloads
9
Maintainers
Readme
Shīkensu
シーケンス
Sequence
Run a sequence of functions on in-memory representations of files.
Build static websites with ease, without conforming to a specific structure.
Port
This is a port of the original Haskell version.
Usage
This library was built with flow-static-land, which you may or may not use.
You can look at the examples for both use cases:
It basically boils down to this:
import * as shikensu from "shikensu"
import { renameExt, permalink } from "shikensu/lib/contrib"
const io =
fn => dictionary => fn(dictionary)()
shikensu.listRelative("./blog", ["posts/**/*.md"])()
.then(io(read))
.then(renameExt(".md", ".html"))
.then(permalink("index"))
.then(io(write("build")))Given ./blog/posts/code/example-post.md,
this code will produce ./blog/build/code/example-post/index.html.
Contrib
You can see all the functions in the source code which includes documentation and some examples.
List functions
The main module has the following list functions:
list(absolutePath: string, patterns: Array<string>)listF(patterns: Array<string>, absolutePath: string)listRelative(relativePath: string, patterns: Array<string>)listRelativeF(patterns: Array<string>, relativePath: string)
And the following functions to construct paths:
absolutePath(definition)localPath(definition)workspacePath(definition)
See the source code for other functions.
Curried functions
All functions are curried by default.
This means that you can make all these combinations:
renameExt(a, b, c)renameExt(a, b)(c)renameExt(a)(b)(c)
