Blash : Usages and configuration

Blash is a CLI tool. It's relatively simple to use it.


What's a CLI tool ?

If you're here, you should already know. But, we could say a CLI tool is something that is not using any graphical interface.
To be more precise CLI means Command Line Interface.

Usages

Here are some commands available (execute blash -h to have all commands) :

As this site is also built using blash, and sources provided, you could easily test it, or follow some examples.

Enhance your site

Themes

Blash is provided with a set of basic themes. Themes are a collection of files, usually, a configuration file, layout one, and public files (css, images, ...).

In the sub-directory themes you'll be able to find some. To try them, use :

Templates

Templates or Layout is a system where you build your pages, include other pages, make statements, and Blash takes it all and build your site.

All template files MUST have the .md extension.

Templates : structure example

You could for example have a template for the index pages, one for the page containing text only, and another for your photo posts.
All of these pages include a header file. You could have something like this :

+ templates (dir) :
|
+- index.md
|  @include header.md
|
+- posts.md
|  @include header.md
|
+- photos.md
|  @include header.md
|  @include js-photo.md
|  @include css-photo.md
|
+- header.md
|  @include css-global.md
|
+- css-global.md
|
+- js-photo.md
|
+- css-photo.md

Templates : File structure

A Template file is composed of two parts :

Here is an example :

---
colorcss: blue
testing: true
---
@include global-css
@if !testing
    @include {{ colorcss }}
@end

A so **beautiful** test.

Templates : Variables

Variable identifier should only use [A-Za-z_]. Notice that any number is not allowed in a variable name.

{{ var }}

{{ content }} # embed child layout output

Templates : Directives

As you could see, Blash is able to understand directives. Those directives start with a @ and MUST be the first element on a line.
Directives are :

Templates : Directives examples

Example for the @each variable ... @end :

myVar = [
    {
        "title": "first",
        "content": "example1",
    },
    {
        "title": "second",
        "content": "example2",
    },
]

is (internally) encoded as:

myVar_0_title=first
myVar_0_content=example1

myVar_1_title=second
myVar_1_content=example2

and using the following template:

@each myVar
    {{ idx }} : {{ title }} - {{ content }}
@end

becomes:

    0 : first - example1
    1 : second - example2

Please note the idx variable is used internally by Blash.

Example for the @cmd ... @end :

@cmd
  for i in {1..10}; do
    echo "$i"
  done
@end

Templates : Default variables

Currently, Blash is aware of 3 (three) types of pages :

Here is a list of default variables sets by Blash :

Posts configuration

The headers in post indicate how Blash has to gerenerate your HTML :

Blash configuration

Blash is able to load a config file either by itself (if your config file is named blash.conf) or by using the -f filename.
Here are some variables you could change (in fact all could be changed, it will depend on your needs) :

Draft & Hidden posts:

blash