1.0.0-beta.29 • Published 2 years ago

babel-plugin-transform-diffhtml v1.0.0-beta.29

Weekly downloads
1
License
MIT
Repository
-
Last release
2 years ago

<±/> babel-plugin-transform-diffhtml

Babel transform for pre-parsing and compiling diffHTML template functions to createTree calls which reduces runtime HTML parse cost.

Latest version: 1.0.0-beta.29

Refer to the website https://diffhtml.org/tools.html#babel-transform for documentation.

Installation

Using npm:

npm install --save-dev babel-plugin-transform-diffhtml

or using yarn:

yarn add babel-plugin-transform-diffhtml --dev

Simple example

.babelrc:

{
  "plugins": [
    ["babel-plugin-transform-diffhtml", { "createTree": "_diffhtml.html" }]
  ]
}

input.js:

import { innerHTML, html } from 'diffhtml';

function main() {
  innerHTML(document.body, html`
    <div><h1>Hello world</h1></div>
  `);
}

main();

babel input.js:

var _vtree = _diffhtml.html("#text", "Hello world");

import { innerHTML, html } from 'diffhtml';

function main() {
  innerHTML(document.body, _diffhtml.html("div", {}, [_diffhtml.html("h1", {}, [_diffhtml.html("#text", "Hello world")])]));
}

main();

You may need to tweak the "createTree" option to get the appropriate output in the source to match how diffHTML is embedded and what build system you used.

1.0.0-beta.29

2 years ago

1.0.0-beta.28

2 years ago

1.0.0-beta.26

2 years ago

1.0.0-beta.27

2 years ago

1.0.0-beta.24

2 years ago

1.0.0-beta.25

2 years ago

1.0.0-beta.22

2 years ago

1.0.0-beta.23

2 years ago

1.0.0-beta.21

2 years ago

1.0.0-beta.20

3 years ago

1.0.0-beta.19

3 years ago

1.0.0-beta.18

4 years ago

1.0.0-beta.17

4 years ago

1.0.0-beta.16

4 years ago

1.0.0-beta.15

4 years ago

1.0.0-beta.14

4 years ago

1.0.0-beta.13

4 years ago

1.0.0-beta.12

4 years ago

1.0.0-beta.11

4 years ago

1.0.0-beta.10

5 years ago

1.0.0-beta.9

7 years ago

1.0.0-beta.8

7 years ago

1.0.0-beta.7

7 years ago

1.0.0-beta.6

7 years ago

1.0.0-beta.5

7 years ago

1.0.0-beta.4

7 years ago

1.0.0-beta.3

7 years ago

1.0.0-beta.2

7 years ago

1.0.0-beta.1

7 years ago

1.0.0-beta

7 years ago