Watch
1
0
Fork
You've already forked flora
0
forked from nick/flora
A static site generator.
  • Ruby 99.2%
  • Shell 0.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Nick Vladimiroff 3530699ea8 RELEASE: v1.1.5.
2026-01-24 14:53:46 -05:00
bin Lilac: include a text tag. 2026-01-13 14:20:44 -05:00
exe CLI: support cli commands for build and serve. 2025-11-29 13:44:53 -05:00
lib RELEASE: v1.1.5. 2026-01-24 14:53:46 -05:00
test Tests: fix a transient bug. 2026-01-17 19:41:02 -05:00
tmp A test blog. 2025-11-28 14:35:34 -05:00
.document Lilac: include a text tag. 2026-01-13 14:20:44 -05:00
.gitignore A test blog. 2025-11-28 14:35:34 -05:00
.woodpecker.yml ci: remove 3.3 and 3.2 2025-12-30 16:06:57 -05:00
flora.gemspec Require at least Ruby 3.4. 2025-12-30 15:33:41 -05:00
Gemfile Ruby Page: actually handle links. 2025-11-29 14:30:25 -05:00
Gemfile.lock RELEASE: v1.1.5. 2026-01-24 14:53:46 -05:00
LICENSE.txt Fresh gem. 2025-11-28 13:40:38 -05:00
Rakefile Fresh gem. 2025-11-28 13:40:38 -05:00
README.md Introduce view extensions, and rename plugin to use. 2025-12-30 12:53:52 -05:00

Flora

A static site generator.

Quickstart

Make a new directory with a Gemfile that looks like this:

source "https://rubygems.org"

gem 'flora'

Make a new index.rb file that looks like this:

html do
  body do
    h1 do
      'Hello world!'
    end
  end
end

Install everything with bundle install, and then run bundle exec flora serve and open up http://localhost:3000!

Lilac

Lilac is Flora's DSL for writing HTML. Tags are just methods named the same as the tag, and children of tags are put inside blocks.

Looking for a way to make reusable components? Write a function! For example:

# lib/my_helpers.rb
module MyHelpers

  def cool_title(text)
    div(class: 'title') do
      h1 do
        text
      end
    end
  end

end

# _config.rb
extend_view(MyHelpers)

# index.rb
html do
  body do
    cool_title('My blog')
  end
end

The Flora way

Flora is an opinionated static site generator, and you should generally follow those opinions when making a site in Flora.

Static only

Flora will only ever generate static websites. If you need dynamic content, look elsewhere! (I'd suggest Rails!)

A Ruby-first approach

Flora prefers Ruby and you should too. Configuration and HTML-generation code is in Ruby. Not everything makes sense as Ruby (you should write content-heavy pages in Markdown, for example), but it's the default option for solving problems in a Flora project.

File-based routing

Flora doesn't have a routes file. Instead, requests are routed by convention based on your file's path. While this is the default, some things--like the Redirector plugin--can subvert this opinion when needed.

Unopinionated but pluggable

Flora is a generic static site generator and doesn't favor any particular use case. Making Flora do specific things better is achieved using plugins. Flora ships with a few plugins for common use cases like blogs and handling static files.