Skip to content

goncharovnikita/desert-plains

Repository files navigation

desert-plains

DesertPlains is a template language, it compiles down to HTML

Language files has extension .desertp

Html, css and js are all written in one file

Installation

Mac OS

  curl -L https://github.com/goncharovnikita/desert-plains/releases/latest/download/desert-plains-macOS.tar.gz > ./desert-plains-macos.tar.gz
  tar -xvzf ./desert-plains-macos.tar.gz
  mv ./desert-plains /usr/local/bin/desert-plains
  rm ./desert-plains-macos.tar.gz

Why?

That's my fun project to learn haskell

Main idea is to create lightweight syntax to describe state of the page and add ability to compile it code using some popular libraries such as React

Syntax

Everything must be enclosed in tags - []

Page should contain at least [head] and [body]

[body
    [h1 "Title of the page"]
]

Will be compiled to

<body>
    <h1>Title of the page</h1>
</body>

Classes written after name of tag, divided by dot:

[body.some.class]

Will be compiled to

<body class="some class"></body>

Css

For some reason every css modifier should be in tag:

[style
    [.some-class
        height: 100px;
        width: auto;
    ]
]

Will be compiled to

<style>
    .some-class {
        height: 100px;
        width: auto;
    }
</style>

Examples

Test example with .desertp file and compiled html are in examples folder

Usage

To start compiler run desert-plains-exe --src .. --dest .. It will start a compiler with watcher, which will compile index.desertp to index.html

TODO:

  • Add script engine
  • Add javascript support