All Projects → hashobject → Perun

hashobject / Perun

Licence: epl-1.0
Programmable static site generator built with Clojure and Boot (HELP NEEDED!)

Programming Languages

clojure
4091 projects

Projects that are alternatives of or similar to Perun

Cms.js
Client-Side JavaScript Site Generator
Stars: ✭ 3,016 (+776.74%)
Mutual labels:  static-site-generator
Bridgetown
A Webpack-aware, Ruby-powered static site generator for the modern Jamstack era
Stars: ✭ 317 (-7.85%)
Mutual labels:  static-site-generator
Yellow
Datenstrom Yellow is for people who make small websites.
Stars: ✭ 325 (-5.52%)
Mutual labels:  static-site-generator
Finit
Fast init for Linux systems. Cookies included
Stars: ✭ 293 (-14.83%)
Mutual labels:  boot
Cogear.js
Modern static websites generator (Node.JS/Webpack)
Stars: ✭ 315 (-8.43%)
Mutual labels:  static-site-generator
Publish
A static site generator for Swift developers
Stars: ✭ 3,719 (+981.1%)
Mutual labels:  static-site-generator
Gatsby Starter Bootstrap
Gatsby starter for bootstrap
Stars: ✭ 272 (-20.93%)
Mutual labels:  static-site-generator
Superboot
随着技术日新月异,新技术新平台不断出现,对现如今的开发人员来说选择快速高效的框架进行项目开发,既能提高产出,又能节约时间。本框架无需开发即可实现服务注册、服务发现、负载均衡、服务网关、配置中心、API管理、分布式事务、支撑平台、集成框架、数据传输加密等功能,是学习SpringCloud整体业务模式的完整示例,并且可以直接用于生产环境
Stars: ✭ 341 (-0.87%)
Mutual labels:  boot
Middleman Blog
Middleman : Blog Engine Extension
Stars: ✭ 317 (-7.85%)
Mutual labels:  static-site-generator
Publii
Publii is a desktop-based CMS for Windows, Mac and Linux that makes creating static websites fast and hassle-free, even for beginners.
Stars: ✭ 3,644 (+959.3%)
Mutual labels:  static-site-generator
Opencore Vanilla Desktop Guide
Host for files for the OpenCore Vanilla Desktop Guide
Stars: ✭ 299 (-13.08%)
Mutual labels:  boot
Aio Boot
AIO Boot is an All-in-One bootable software for USB and HDD. Is one of the best Multiboot USB Creator for Windows.
Stars: ✭ 300 (-12.79%)
Mutual labels:  boot
Beautiful Jekyll
✨ Build a beautiful and simple website in literally minutes. Demo at https://beautifuljekyll.com
Stars: ✭ 3,778 (+998.26%)
Mutual labels:  static-site-generator
Docpad
Empower your website frontends with layouts, meta-data, pre-processors (markdown, jade, coffeescript, etc.), partials, skeletons, file watching, querying, and an amazing plugin system. DocPad will streamline your web development process allowing you to craft powerful static sites quicker than ever before.
Stars: ✭ 3,035 (+782.27%)
Mutual labels:  static-site-generator
Phenomic
DEPRECATED. Please use Next.js instead.
Stars: ✭ 3,264 (+848.84%)
Mutual labels:  static-site-generator
Verless
A simple and lightweight Static Site Generator.
Stars: ✭ 276 (-19.77%)
Mutual labels:  static-site-generator
Easy Hexo
🤘 Build your own website with Hexo, the easy way. | 轻松使用 Hexo 建站。
Stars: ✭ 314 (-8.72%)
Mutual labels:  static-site-generator
Lektor
The lektor static file content management system
Stars: ✭ 3,493 (+915.41%)
Mutual labels:  static-site-generator
Gridsome Portfolio Starter
A simple portfolio theme for Gridsome powered by Tailwind CSS v1
Stars: ✭ 329 (-4.36%)
Mutual labels:  static-site-generator
Skeleventy
A skeleton boilerplate built with Eleventy.
Stars: ✭ 318 (-7.56%)
Mutual labels:  static-site-generator

perun-logo-big

Clojars Project Dependencies Status Downloads

Simple, composable static site generator built on top of the Boot. Inspired by Boot task model and Metalsmith. Perun is a collection of boot tasks that you can chain together and build something custom that suits your needs. Please check out our Getting Started guide.

HELP NEEDED!

This project is currently unmaintained! Want to help? Please see #241.

For information and help

Clojurians slack (join) has a channel #perun for talk about Perun.

Check SPEC.md for documentation about metadata keys used by built-in tasks.

Plugins

See the Built-Ins Guide for a list of built-in tasks.

3rd party useful plugins

There are plenty of Boot plugins that can be useful in the when you are using perun:

Version

Perun is currently tested against Boot 2.8.2. Higher versions are blocked by https://github.com/boot-clj/boot/issues/745.

Plugins system

Everything in perun is build like independent task. The simplest blog engine will look like:

(deftask build
  "Build blog."
  []
  (comp (markdown)
        (render :renderer renderer)))

But if you want to make permalinks, generate sitemap and rss feed, hide unfinished posts, add time to read to each post then you will do:

(deftask build
  "Build blog."
  []
  (comp (markdown)
        (draft)
        (ttr)
        (slug)
        (permalink)
        (render :renderer renderer)
        (sitemap :filename "sitemap.xml")
        (rss :site-title "Hashobject" :description "Hashobject blog" :base-url "http://blog.hashobject.com/")
        (atom-feed :site-title "Hashobject" :description "Hashobject blog" :base-url "http://blog.hashobject.com/")
        (notify)))

You can also chain this with standard boot tasks. E.x. if you want to upload generated files to Amazon S3 you might use boot-s3 plugin.

Then your code might look like this:

(deftask build
  "Build blog."
  []
  (comp (markdown)
        (render :renderer renderer)
        (s3-sync)))

Use cases

  • Generate blog from markdown files.
  • Generate documentation for your open source library based on README.
  • Any case where you'd want to use Jekyll or another static site generator.

Examples

A minimal blog example, included in this repo. See build.boot

Real-world websites created with perun:

How does it work

Perun works in the following steps:

  1. Read all the files from the source directory and create fileset metadata (:metadata (meta fileset) with all meta information available for all tasks/plugins
  2. Call each perun task/plugin to manipulate the fileset metadata
  3. Write the results to the destination/target directory

Perun embraces Boot task model. Fileset is the main abstraction and the most important thing you should care about. When you use perun you need to create custom task that is a composition of standard and 3d party tasks/plugins/functions. Perun takes set of files as input (e.x. source markdown files for your blog) and produces another set of files as output (e.x. generated deployable html for your blog).

Fileset passed to every task has metadata (:metadata (meta fileset). This metadata contains accumulated information from each task. More info about structure of this metadata is coming.

Install

[perun "0.3.0"]

Usage

Create build.boot file with similar content. For each task please specify your own options. See documentation for each task to find all supported options for each plugin.

(set-env!
  :source-paths #{"src"}
  :resource-paths #{"resources"}
  :dependencies '[[org.clojure/clojure "1.7.0"]
                  [hiccup "1.0.5"]
                  [perun "0.2.0-SNAPSHOT"]
                  [clj-time "0.9.0"]
                  [hashobject/boot-s3 "0.1.2-SNAPSHOT"]
                  [jeluard/boot-notify "0.1.2" :scope "test"]])

(task-options!
  pom {:project 'blog.hashobject.com
       :version "0.2.0"}
  s3-sync {
    :bucket "blog.hashobject.com"
    :source "resources/public/"
    :access-key (System/getenv "AWS_ACCESS_KEY")
    :secret-key (System/getenv "AWS_SECRET_KEY")
    :options {"Cache-Control" "max-age=315360000, no-transform, public"}})

(require '[io.perun :refer :all])
(require '[hashobject.boot-s3 :refer :all])
(require '[jeluard.boot-notify :refer [notify]])

(defn renderer [{global :meta posts :entries post :entry}] (:name post))

(defn index-renderer [{global :meta files :entries}]
  (let [names (map :title files)]
    (clojure.string/join "\n" names)))

(deftask build
  "Build blog."
  []
  (comp (markdown)
        (draft)
        (ttr)
        (slug)
        (permalink)
        (render :renderer renderer)
        (collection :renderer index-renderer :page "index.html")
        (sitemap :filename "sitemap.xml")
        (rss :site-title "Hashobject" :description "Hashobject blog" :base-url "http://blog.hashobject.com/")
        (s3-sync)
        (notify)))

After you created build task simply do:

boot build

Tips

Debug

To see more detailed output from each task (useful for debugging) please use --verbose boot flag. E.x. boot --verbose dev

Development setup

Perun is static site generator. So usually you'd use it by just running boot build which will generate your static site. This process is robust and great for production but it's slow and lacks fast feedback when you're developing your site locally. In order to solve this problem we recommend following setup:

  1. Have 2 separate tasks for building local version and production version. E.x. build-dev and build.
  2. Include boot-http into your build.boot file. This will enable serving your site using web server.
  3. Create task dev that will call build-dev on any change to your source files:
  (deftask dev
    []
    (comp (watch)
          (build-dev)
          (serve :resource-root "public")))
  1. Runboot dev In such setup you will have HTTP web server serving your generated content that would be regenerated every time you change your source files. So you'd be able to preview your changes almost immediately.

Auto deployment

It's quite easy to setup automatic static site deployment. E.x. you have GitHub repo for your blog and you are using boot-s3 to sync files to Amazon S3. In this case it's possible to setup flow in a way that every commit to GitHub would be built on Heroku using perun and deployed to AWS S3.

Assuming you have setup similar to example in order to achieve this you need to:

  • create Heroku application for your GitHub repo with build.boot file
  • ensure that build.boot has build task that has tasks build and deploy tasks
  • specify AWS_ACCESS_KEY and AWS_SECRET_KEY envs. They are mandatory for the boot-s3 plugin).
  • add boot/perun buildpack heroku buildpacks:add https://github.com/hashobject/heroku-buildpack-perun
  • enable GitHub integration https://devcenter.heroku.com/articles/github-integration
  • change your site in GitHub and see changes deployed to AWS S3 in few minutes

Similar auto deployment can be configured using CircleCI too.

Contributions

We love contributions. Please submit your pull requests.

Main Contributors

Copyright and License

Copyright © 2013-2019 Hashobject Ltd ([email protected]) and perun Contributors.

Distributed under the Eclipse Public License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].