#scripting-language #html #declarative #web #document #context #modifying

bin+lib sarascript

A declarative scripting language for HTML web development

1 unstable release

0.1.0 Jan 9, 2024

#11 in #modifying

MIT/Apache

44KB
922 lines

A lightweight declarative language for HTML

Please note that this software is in alpha, and many features have not been implemented yet.

SaraScript is a simple declarative language which can be used to extend an HTML document. SaraScript can be used as:

  • A static-site generator.
  • A server-side renderer[^1].
  • An asynchronous client-side renderer[^1]. [^1]: "Rendering" in a web context is typically just modifying the HTML so that the browser may render it properly

Use Cases:

Since SaraScript can be used in three distinct ways, this table compares each version:

Version Use Case Pros Cons
Server Server-side rendering No client scripts & Reduced Server Storage Increased Server CPU & Increased Network Traffic
Client Client-side rendering Reduced server storage & Minimal server CPU Client-side scripts
Standalone Static-site generation No client scripts & Minimal server CPU Larger Server Storage
Library Used in custom webservers N/a N/a

How is SaraScript different from alternatives? (Like PHP or JavaScript)

  • Security: SaraScript puts security first. Like most HTML-related languages, Sarascript's core library is designed to be secure. However, unlike most similar languages, SaraScript will not allow you to create vulnerabilities in your website.
  • Declarative: SaraScript is a declarative language. This means that rather than defining a series of steps taken to retrieve a piece of data, you define the data that you'd like to retrieve and let the program handle the actual retrieval. Why is this a benefit? A developer only needs to focus on creating the layout and design of their webpage, rather than optimizing how their data is retrieved. Furthermore, as time goes on and the language improves, your queries will become faster.
  • Ease-of-Use SaraScript is a focused project. It seeks to provide a way to query the backend declaratively and seeks to do it well. As a result, the project is small, unambiguous, and easy-to-use.

How to Install?

This section needs a redo. This is just a placeholder.

Version Instructions
Client or Server Install the daemon, edit the config, and run the daemon
Standalone Download or build the binary
Library Add the cargo package

Examples

  • Adding a navbar/footer/etc. to every page
  • Adding a user's profile picture to the page.
  • Generating static web pages

Misc

This project practices semantic versioning: https://semver.org/spec/v2.0.0.html

Name

The hero shrew is a small cute mouse-like creature with an incredibly strong spine. Though they are the size of a deck of cards - they are said to be able to support the weight of an adult male without harm. The animal is native the the DRC. musaraigne is the word for shrew in French - I was unable to find the name in Kituba.

Dependencies

~15–26MB
~400K SLoC