andamira / webera.sh

a handy static website generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

webera

version: 0.2.x language: bash CII Best Practices


Table of Contents

Intro

webera is a shell script intended for the generation of static websites.

It aims to be a lightweight tool that just works, very configurable, and with sensible defaults.

Use Cases

If you want:

  • absolute control of the generated HTML.
  • to be able to run it anywhere there is Bash.
  • to use a very configurable CLI tool with minimal footprint.
  • to have a very versatile tool in a single file you can grok.

Features

  • The configuration system allows to define and perform operations over static resources and templates, and to create routes for those templates.
  • The templating system allows to nest templates, set variables and display the output of custom commands.

Quick Start

  1. Download webera and make it executable: (see Install)
$ wget git.io/webera && chmod +x webera
  1. Create a directory called tem/ and put there your HTML templates, then configure the corresponding routes in the config file.

E.g. This will process the templates from tem/* to out/*/index.html:

template : route : my-index.html   : /
template : route : other-page.html : /other-url/
  1. Put your styles under res/css/ and configure how it will be processed (the simplest operation is to copy them):

E.g. This will copy the directory res/css/ to out/css/:

resource : copy : css/ : css/
  1. Generate the website by telling the script to process all the configured templates and resources.
$ ./webera --process-all

The website is generated by default in the out/ directory:

$ find out/

  out/
  out/index.html
  out/other-url/index.html
  out/res/css/style.css

Documentation

The wiki is the documentation reference.

Config

The following configuration snippet shows you how to set options, define custom commands, process the resources and the templates, and route them:

# Customized Options
config : WEB_BROWSER_BIN : chromium-browser
config : DIR_OUTPUT      : /home/$USER/my-website

# Define Custom Commands
command : sass2css : sass {ORIGIN} {TARGET}

# Process Resources
resource : sass2css : scss/styles.scss : css/main.css

# Process Templates to URL Endpoints
template : route : index.html     : /
template : route : about.html     : /about/
template : route : about-me.html  : /about/me/
template : route : about-you.html : /about/you.html

See .weberarc and the Configuration wiki page, for more information about the configuration possibilities.

Run

There are several flags that allows you to control the scripts behaviour in the moment, complementing a more stable configuration. See the wiki page for the order of priority of all the configuration sources.

You can run ./webera --help to see the basic help on flags, see some usage examples, or take a deeper look to the complete list of flags in the wiki.

Complete Examples

There are several examples:

Install

Manually

You can use either wget or curl -LO to download the script, and then make it executable:

$ wget git.io/webera && chmod +x webera

To install it globally:

$ sudo sh -c "wget git.io/webera -O /usr/local/bin/webera && chmod +x /usr/local/bin/webera"

In Mac OS X

In order to work well in Mac OS X you need a more recent version of Bash than the one that comes by default, and also the GNU version of coreutils, sed, grep and awk. An easy way to install them is using Brew:

$ brew tap homebrew/dupes
$ brew install bash coreutils gnu-sed grep gawk

Status

This project is not yet in a stable state.

It also lacks important planned features like: template metadata, custom post types, blog support, plugin system, internationalization support, starter templates, dynamic functionality via cgi scripts…

About

a handy static website generator

License:MIT License


Languages

Language:Shell 99.4%Language:HTML 0.6%