All Projects → callmecavs → string-dom

callmecavs / string-dom

Licence: other
Create HTML strings using JSX (or functions).

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to string-dom

hsx
Static HTML sites with JSX and webpack (no React).
Stars: ✭ 15 (+15.38%)
Mutual labels:  dom, jsx
prax
Experimental rendering library geared towards hybrid SSR+SPA apps. Focus on radical simplicity and performance. Tiny and dependency-free.
Stars: ✭ 18 (+38.46%)
Mutual labels:  dom, jsx
recks
🐶 React-like RxJS-based framework
Stars: ✭ 133 (+923.08%)
Mutual labels:  dom, jsx
Prakma
Prakma is a framework to make applications using JSX, focusing on writing functional components.
Stars: ✭ 16 (+23.08%)
Mutual labels:  dom, jsx
Preact
⚛️ Fast 3kB React alternative with the same modern API. Components & Virtual DOM.
Stars: ✭ 30,527 (+234723.08%)
Mutual labels:  dom, jsx
Nativejsx
JSX to native DOM API transpilation. 💛 <div> ⟹ document.createElement('div')!
Stars: ✭ 145 (+1015.38%)
Mutual labels:  dom, jsx
vanilla-jsx
Vanilla jsx without runtime. HTML Tag return DOM in js, No virtual DOM.
Stars: ✭ 70 (+438.46%)
Mutual labels:  dom, jsx
callbag-jsx
callbags + JSX: fast and tiny interactive web apps
Stars: ✭ 69 (+430.77%)
Mutual labels:  dom, jsx
Hyperawesome
A curated list of awesome projects built with Hyperapp & more.
Stars: ✭ 446 (+3330.77%)
Mutual labels:  dom, jsx
Jsx Dom
Use JSX to create DOM elements.
Stars: ✭ 117 (+800%)
Mutual labels:  dom, jsx
Preact Markup
⚡️ Render HTML5 as VDOM, with Components as Custom Elements!
Stars: ✭ 167 (+1184.62%)
Mutual labels:  dom, jsx
React Tilt
👓 Parallax tilt hover effect for React JS - tilt.js
Stars: ✭ 254 (+1853.85%)
Mutual labels:  dom
Lite Virtual List
Virtual list component library supporting waterfall flow based on vue
Stars: ✭ 223 (+1615.38%)
Mutual labels:  dom
Angular Ru Interview Questions
Вопросы на собеседовании по Angular
Stars: ✭ 224 (+1623.08%)
Mutual labels:  dom
Asm Dom
A minimal WebAssembly virtual DOM to build C++ SPA (Single page applications)
Stars: ✭ 2,604 (+19930.77%)
Mutual labels:  dom
html-parser
A simple and general purpose html/xhtml parser, using Pest.
Stars: ✭ 56 (+330.77%)
Mutual labels:  dom
Disintegrate
A small JS library to break DOM elements into animated Canvas particles.
Stars: ✭ 251 (+1830.77%)
Mutual labels:  dom
Slip
Slip.js — UI library for manipulating lists via swipe and drag gestures
Stars: ✭ 2,421 (+18523.08%)
Mutual labels:  dom
Abort Controller
An implementation of WHATWG AbortController interface.
Stars: ✭ 213 (+1538.46%)
Mutual labels:  dom
Javascript Interview Questions
500+ JavaScript Interview Questions
Stars: ✭ 208 (+1500%)
Mutual labels:  dom

string-dom

string-dom on Travis string-dom on NPM Standard JavaScript Style

Create HTML strings using JSX (or functions).

About

string-dom is a function that creates an HTML string.

  • It is made to work with JSX, but renders it to a string, instead of to DOM.
  • With string-dom, JSX becomes an HTML templating language that can be used separately of React.

Install

$ npm i string-dom --save

Usage

import sd from 'string-dom'

/** @jsx sd */

// with JSX
// note the comment above, and see the link below
// https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx#custom
document.body.innerHTML += (
  <div class="wrapper">
    <h1 class="heading" data-heading="data-heading">Heading Text</h1>
    <p class="heading-sub" data-subheading="data-subheading">Subheading Text</p>
    <p>An element without attributes.</p>
  </div>
)

// without JSX
document.body.innerHTML += (
  sd('div', { class: 'wrapper' },
    sd('h1', { class: 'heading', 'data-heading': 'data-heading' }, 'Heading Text'),
    sd('p', { class: 'heading-sub', 'data-subheading': 'data-subheading' }, 'Subheading Text'),
    sd('p', 'An element without attributes.')
  )
)

Both the above generate the following HTML (as a string), then add it to the body:

<div class="wrapper">
  <h1 class="heading" data-heading="data-heading">Heading Text</h1>
  <p class="heading-sub" data-subheading="data-subheading">Subheading Text</p>
  <p>An element without attributes.</p>
</div>

Prior Art

Linting

JS Standard Style

License

MIT. © 2017 Michael Cavalea

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].