Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/massivefermion/domguy
generate a dom tree from js
https://github.com/massivefermion/domguy
Last synced: about 1 month ago
JSON representation
generate a dom tree from js
- Host: GitHub
- URL: https://github.com/massivefermion/domguy
- Owner: massivefermion
- License: apache-2.0
- Created: 2021-06-29T07:21:45.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-06-30T10:47:07.000Z (over 3 years ago)
- Last Synced: 2024-11-16T15:20:20.391Z (about 1 month ago)
- Language: JavaScript
- Size: 16.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# domguy
generate dom trees from js
## Install
`npm install domguy`
## Usage
```javascript
import { chainable, elements } from 'domguy'
import { writeFileSync } from 'fs'const root = chainable({ prettify: true })
const { head, meta, title, body, div, h1 } = elementsconst page = root
.html(
[
head([
meta({
std: [['charset', 'UTF-8']],
}),
meta({
std: [
['http-equiv', 'X-UA-Compatible'],
['content', 'IE=edge'],
],
}),
meta({
std: [
['name', 'viewport'],
['content', 'width=device-width, initial-scale=1.0'],
],
}),
title('Document'),
]),
body(
[
div(h1('Hello World!'), {
std: [
['style', ['display:flex;', 'justify-content:space-between;']],
],
}),
],
{
std: [['style', 'margin:128px;']],
}
),
],
{
std: [['lang', 'en']],
nstd: [['non-standard-attribute', 'value']],
}
)
.toString()writeFileSync('page.html', page, 'utf8')
```