B4J Library [B4X][Web] MiniHtml2

Attachments

  • MiniHtml2.b4xlib
    7.8 KB · Views: 9
Last edited:

aeric

Expert
Licensed User
Longtime User
Current release 2.00-alpha is still under development. It is created in a few hours without thoroughly tested.

This version is not backward compatible with previous version which is currently v0.90

Key differences from previous version are:
  1. MiniHtml object/class instead of Tag.
  2. No modules for quick tag creation.
  3. You need to initialize the object first.
  4. However, you can create a reusable function named CreateTag.
  5. This is more flexible because you can name the CreateTag function to any other name you like, eg NewTag.
  6. Many functions are removed so it is more cleaner and lightweight
  7. No Bootstrap data, Htmx or AlpineJS functions
  8. Smaller file size
  9. Less conflicts with other libraries or variables name
  10. Promote more readable code practice
 

aeric

Expert
Licensed User
Longtime User
No tutorial is shared at the moment but you can check the GitHub project and run the EndsMeet server example.

There is an example in /source/Index.bas

B4X:
    Dim body1 As MiniHtml = CreateTag("body").up(html1)
    Dim div1 As MiniHtml = CreateTag("div").up(body1)
    div1.cls("d-flex align-items-center")
    div1.sty("height: 100vh")
    Dim div2 As MiniHtml = CreateTag("div").up(div1)
    div2.sty("margin: auto")

    Dim div3 As MiniHtml = CreateTag("div").up(div2)
    div3.attr("id", "modals-here")
    div3.cls("modal modal-blur fade")
    div3.sty("display: none")
    div3.attr("aria-hidden", "false")
    div3.attr("tabindex", "-1")
 

peacemaker

Expert
Licensed User
Longtime User
Pardon, stupid dummy's question: isn't the aim of the lib to allow building HTML by "dummies" with minimal HTML tag knowledge ?
Like "create a block", "centered", "max width = 77%", "white background color", "green text of 14 size" ...
 

aeric

Expert
Licensed User
Longtime User
isn't the aim of the lib to allow building HTML by "dummies" with minimal HTML tag knowledge ?
Like "create a block", "centered", "max width = 77%", "white background color", "green text of 14 size" ...
My answer is no.

For dummy web designers, they can use any existing HTML templates created by another developer.

I am also not good in frontend design or write JavaScript.

By using this library, I can convert any nice template which works perfectly into B4X code.
Choose a template which is already making use of other CSS library or frameworks such as Bootstrap and AlpineJS.

With B4X code, I am not switching my mind into html files.

B4J allows me to comment any line of codes and reusing some functions.

This library generates html output that avoid missing or extra html closing tags. The output is always beautiful and perfect.

I can't say it can minimize html tags. It only make me feel comfortable writing in B4X.

You can also check this tutorial but it is for version 0.x
 
Last edited:
Top