Releases: abstra-app/sugar
Releases · abstra-app/sugar
v0.2.0a1
New Features
- Implicit div:
.foo:and#bar:default to<div> - #id shorthand:
canvas#game:→<canvas id="game"> - Implicit children:
ul > : Item→<li>,select > value=x: X→<option>,tr > : Cell→<td>,thead > : Header→<th> - Server-side templating:
sugar(code, data)with{expr}interpolation,for/ifin HTML - Components:
card = (title):withslot:for children injection - CSS mixins:
reset = ():with@reset()expansion - html! template literals:
html!:inside script blocks compiles sugar to JS template literal strings - Object literals: indented key/value syntax compiles to
{key: value} - SugarWarning: warns on non-idiomatic syntax (explicit div, explicit implicit children)
check_source(): public API for linting, returnsList[dict]with line/message/level- Vim/Neovim syntax: comprehensive highlighting for all AST elements
Breaking Changes
- Comments now require
#(space after hash) to distinguish from#id sugar()accepts optionaldatadict as second parameter
Install
pip install abstra-sugar==0.2.0a1v0.1.0a1
First alpha release of Sugar.
A template language that compiles to HTML + CSS + JS using indentation-based syntax inspired by Pug, Stylus, and CoffeeScript.
Features
- HTML: elements, classes, attributes, inline elements, void elements, comments
- CSS: selectors, properties, nesting, pseudo-selectors, at-rules
- JS: functions, arrows, for/if/while, classes, try/catch, object literals, auto-semicolons
Usage
from abstra_sugar import sugar
html = sugar(open("page.sugar").read())