1.0.2 • Published 1 year ago

obj-ui v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

obj-ui

obj-ui is an npm package for creating static HTML webpages with object-oriented JavaScript

Overview

obj-ui exports three main classes and two extends classes.

Main classes

  1. The App class represents directory of HTML pages, equivalent to a simple static website.
  2. The Page class represents a HTML page.
  3. The Component class represents a HTML element.

Sub-classes

The Head and Body, classes, which represent head and body html elements respectively, both extend the Component class.

Quickstart

  1. Make a new, empty directory and use npm or yarn to install obj-ui
  2. Create an index.js file and add the following code:
const { App } = require('obj-ui')

const app = new App({ outDir: 'build', lang: 'en' })
app.page('index', indexPage => {
    indexPage.head(headComponent => {
        headComponent.child('title', titleComponent => {
            titleComponent.text('Hello, world!')
        })
    })
    indexPage.body(bodyComponent => {
        bodyComponent.child('h1', heading => {
            heading.text('Hello, world!')
        })
    }) 
})

app.build()
  1. Run node index.js from the working directory. A /build folder should be generated automatically in the root directory.
  2. Open /build/index.html.
  3. Browse the API Docs
1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.8.9

2 years ago