Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/superfola/forge
A set of functions to generate HTML easily
https://github.com/superfola/forge
dom html-generator javascript npm
Last synced: 3 months ago
JSON representation
A set of functions to generate HTML easily
- Host: GitHub
- URL: https://github.com/superfola/forge
- Owner: SuperFola
- Archived: true
- Created: 2020-05-13T17:24:53.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-05-14T09:27:41.000Z (over 4 years ago)
- Last Synced: 2024-09-21T13:00:13.298Z (3 months ago)
- Topics: dom, html-generator, javascript, npm
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/small-forge
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# small-forge
[![version](https://img.shields.io/npm/v/small-forge.svg?style=flat-square)](http://npm.im/small-forge)
[![downloads](https://img.shields.io/npm/dm/small-forge.svg?style=flat-square)](http://npm-stat.com/charts.html?package=small-forge&from=2020-05-01)A small npm package to generate HTML easily.
## Installing
```shell
npm i small-forge
```## Design goals
* the fewest/smallest dependencies possible (I am one of those people who hate having a lot of small libs to use another bigger lib)
* simplicity
* use and abuse of `...args`
* documentation everywhere## Examples
```js
const sf = require('small-forge');
const [div, h1, p, img] = sf.forgeSomeElements(
'div', { className: 'cool-div' },
'h1', { textContent: 'Hello GitHub!' },
'p', { className: 'big-paragraph', textContent: 'A small package to generate HTML easily' },
'img', { src: 'public/img/sf.png', alt: 'small-forge logo' }
);sf.forgeStyle(div, {
opacity: 1.0,
transition: 'opacity 1s'
});sf.forgeHierarchy(
div, [
h1, p, img
]
);
```