Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sake92/sbt-hepek
Sbt plugin for rendering Scala objects to files. And more!
https://github.com/sake92/sbt-hepek
html sbt sbt-plugin scala static-site-generator
Last synced: 22 days ago
JSON representation
Sbt plugin for rendering Scala objects to files. And more!
- Host: GitHub
- URL: https://github.com/sake92/sbt-hepek
- Owner: sake92
- License: apache-2.0
- Created: 2017-02-08T20:03:06.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-12-08T17:28:29.000Z (11 months ago)
- Last Synced: 2024-10-04T20:39:44.703Z (about 1 month ago)
- Topics: html, sbt, sbt-plugin, scala, static-site-generator
- Language: Scala
- Homepage:
- Size: 43 KB
- Stars: 21
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# sbt-hepek
![Maven Central](https://img.shields.io/maven-central/v/ba.sake/sbt-hepek_2.12_1.0)An sbt plugin for writing Scala `object`s to files.
See also [**hepek**](https://github.com/sake92/hepek), static content generator that builds upon this plugin.## Installation
Add the plugin to `project/plugins.sbt`:
```scala
addSbtPlugin("ba.sake" % "sbt-hepek" % "0.6.0")
```and enable it in `build.sbt`:
```scala
myProject.enablePlugins(HepekPlugin)
```## Usage
The main task of sbt-hepek is `hepek`.
When executed, it will:
1. copy all files from `src/main/resources/public` to `hepek_output` folder
1. write all `object .. extends Renderable` from the `files` package to `hepek_output` folder
1. write accessors for `src/main/resources/public` files, so you don't have to type it, or make mistakesMinimal example:
```scala
package files // mandatory !!import java.nio.file.Paths
import ba.sake.hepek.core.Renderableobject RenderMe extends Renderable {
// access `src/main/resources/public` files through autogenerated files.
override def render =
"Some text" // arbitrary Scala code
override def relPath =
Paths.get("renderme.txt")
}
```When you run `sbt hepek`, you'll find the `hepek_output/renderme.txt` file,
with text `Some text`.## Examples / docs
- [my blog](https://github.com/sake92/sake-ba-source) rendered @ [blog.sake.ba](https://blog.sake.ba)
- [examples](https://github.com/sake92/hepek-examples)
- [philosophy behind hepek](https://dev.to/sake_92/render-static-site-from-scala-code)---
## Fun fact
I think that this is the first project that tried this approach, namely, using first-class Scala `object`s for this kind of stuff.
Correct me if I'm wrong... ^_^---
## About the name
A "hepek" in Bosnian language is a jargon for a thing/thingy/stuff...
It is used when we don't know the name of a thing: "Give me that ... *hepek*".
Also, it is used in the famous show called "Top lista nadrealista" as a name for an advanced device which calms down situations of various kinds.