# fit-html

> 3KB functional Web Components without bloat

Latest version **0.7.0** (published 2018-05-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install fit-html
pnpm add fit-html
yarn add fit-html
bun add fit-html
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.7.0 |
| Published | 2018-05-05 |
| First published | 2017-11-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 125.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 115 |
| Author | Festify Dev Team |
| Maintainers | mraerino, neolegends |

## Links

- npm: https://www.npmjs.com/package/fit-html
- Repository: https://github.com/Festify/fit-html
- Homepage: https://github.com/Festify/fit-html#readme
- Issues: https://github.com/Festify/fit-html/issues
- npm.io page: https://npm.io/package/fit-html

## Recent versions

- 0.7.0 (latest) — 2018-05-05
- 0.1.2 (next) — 2017-11-14
- 0.6.0 — 2018-04-15
- 0.5.4 — 2018-03-16
- 0.5.3 — 2018-02-26
- 0.5.2 — 2018-02-26
- 0.5.1 — 2018-02-21
- 0.5.0 — 2018-02-02
- 0.4.3 — 2018-01-15
- 0.4.2 — 2018-01-15
- 0.4.1 — 2018-01-15
- 0.4.0 — 2018-01-13
- 0.3.10 — 2017-12-28
- 0.3.9 — 2017-12-28
- 0.3.8 — 2017-12-28
- … 12 more at https://npm.io/package/fit-html/versions

## README

# 💪 fit-html

[![npm](https://img.shields.io/npm/v/fit-html.svg)](https://www.npmjs.com/package/fit-html)
[![Travis](https://img.shields.io/travis/Festify/fit-html.svg)](https://travis-ci.org/Festify/fit-html)
[![Bundle Size](http://img.badgesize.io/https://unpkg.com/fit-html/.tmp/index.min.js?compression=gzip)](https://www.npmjs.com/package/fit-html)
[![Greenkeeper badge](https://badges.greenkeeper.io/Festify/fit-html.svg)](https://greenkeeper.io/)

3KB web components + lit-html + redux library without bloat.

## Overview

fit-html is a combination of [lit-html](https://github.com/Polymer/lit-html), web components and [redux](http://redux.js.org/) bringing efficient rendering and a functional application architecture together. Yet, the total size of the framework is below 3KB, including dependencies.

## Small Example

You need the following:
```js
import { connect, withStore } from 'fit-html';
import { html } from 'lit-html/lib/lit-extended';
import { createStore } from 'redux';
```

Set up redux store:
```js
const todos = (state = [], action) => {
  switch (action.type) {
    case 'ADD_TODO':
      return state.concat([action.text]);
    default:
      return state;
  }
};

const store = createStore(todos, ['Use Redux']);
```

Define actions and view:
```js
function addTodo() {
  return {
    type: 'ADD_TODO',
    text: `Hello ${Math.random()}`
  };
}

const render = ({ addTodo, todos }) => html`
  <ul>
    ${todos.map(text => html`<li>${text}</li>`)}
  </ul>

  <button on-click="${addTodo}">
    Add
  </button>
`;

const TodosApp = connect(
  state => ({ todos: state }),
  { addTodo }
)(render);

// Define the custom element.
//
// The withStore mixin is only required for the root element of your
// app. All other 💪-elements will get the redux store from that element.
customElements.define('todo-app', withStore(store)(TodosApp));
```

`index.html`:
```html
<html>
  <head>
    <title>My cool 💪-html app</title>
  </head>
  <body>
    <todo-app></todo-app>
  </body>
</html>
```

Please see https://github.com/Festify/fit-html-demo for more and larger examples.

## Compatibility

💪-html is written for use with evergreen browsers. Not so much for Internet Explorer (though we strive to become compatible with IE11 once lit-html itself is).

## License

MIT

---
_Source: https://npm.io/package/fit-html · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
