项目作者: caonUlisses

项目描述 :
:corn: Create html with JS. As simple as that.
高级语言: JavaScript
项目地址: git://github.com/caonUlisses/polenta.git
创建时间: 2019-07-16T16:30:23Z
项目社区:https://github.com/caonUlisses/polenta

开源协议:MIT License

下载


Polenta

Build status
JavaScript Style Guide
npm bundle size
GitHub
GitHub stars

A tool with modern JS in mind

Polenta?

Polenta (/pəˈlɛntə, poʊˈ-/, Italian: [poˈlɛnta]) is a dish of boiled cornmeal that was historically made from other grains. It may be served as a hot porridge, or it may be allowed to cool and solidify into a loaf that can be baked, fried, or grilled.

Polenta is a simple dish, that may have a simple flavor, but when combined with the right stuff, becomes incredible.

This package exposes functions for each html tag and a render function to
generate elements using either Shadow
DOM

or regular DOM. Nothing else.

Installation

Just run yarn add polenta or npm install polenta if you have a module bundler set up

Usage

A simple use case would be:

In your index.html file:

  1. ...
  2. <div id="root"></div>
  3. <script type="module" src="./path/to/yourFile.js">

And on yourFile.js:

  1. import * as polenta from 'https://www.unpkg.com/polenta@1.0.4/index.js' //
  2. assuming no webpack is to be found
  3. const content = polenta.div('id="my-div" class="blue big"',
  4. polenta.p('class="my-text"', "Hello World"))
  5. polenta.render(content, 'root')

Just functions, no boilerplate, no dependencies, 1.56KB.