Gongsa
Based on the korean word 건설, gongsa is a library to build HTML Components or quickly generate html in a readable format.
This project is minimalistic on purpose, meaning it won't have any sort of reactivity.
Usage
Using core components
Using existing components is easy, you can just call them.
final h1 = H1(children: [Text("Hello, world")]);
You can see that that returns a H1
class and not a String
, which would be expected.
To actually "compile" your template, you can use the Builder
classes.
final html = HTMLBuilder(h1).build();
final xml = XMLBuilder(h1).build();
As you can see, any class that implements Builder
could be used to build content.
Creating new components
As expected of a component system, you can also implement your own component.
All components need to implement the Component
interface, which has only 1 Component#render
method,
which should return a component. By having components return the Component
class, the builders could
have some extra optimizations if possible.
Example:
class Foo implements Component {
@override
Component render() {
return Text("foo");
}
}
TODO:
License
This project is under MIT License, which could be seen here.
Libraries
- gongsa
- Support for doing something awesome.