Skip to content

Commit 01d70c0

Browse files
Add Babel plugin (#110)
* add babel plugin * browser tests with babel * export babel plugin similar to browserify transform * skip failing event tests instead of commenting out * run transformed tests in browser * transform: ignore xmlns attributes * make comments work in transform * Remove whitespace collapse from babel plugin * shared files for bool props and svg tags * Remove single text node optimization * document babel plugin * fixup! document babel plugin
1 parent af48b94 commit 01d70c0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+900
-68
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
22
package-lock.json
3+
tests/babel/fixtures/*.actual.js

README.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,38 @@ b.bundle().pipe(process.stdout)
102102
### Webpack
103103
At the time of writing there's no Webpack loader yet. We'd love a contribution!
104104

105-
### Parcel
106-
At the time of writing there's no Parcel plugin yet. We'd love a contribution!
105+
### Babel / Parcel
106+
107+
Add nanohtml to your `.babelrc` config.
108+
109+
Without options:
110+
111+
```js
112+
{
113+
"plugins": [
114+
"nanohtml"
115+
]
116+
}
117+
```
118+
119+
With options:
120+
121+
```js
122+
{
123+
"plugins": [
124+
["nanohtml", {
125+
"useImport": true
126+
}]
127+
]
128+
}
129+
```
130+
131+
### Options
132+
133+
- `useImport` - Set to true to use `import` statements for injected modules.
134+
By default, `require` is used. Enable this if you're using Rollup.
135+
- `appendChildModule` - Import path to a module that contains an `appendChild`
136+
function. Defaults to `"nanohtml/lib/append-child"`.
107137

108138
## Attributions
109139
Shout out to [Shama](https://github.com/shama) and

0 commit comments

Comments
 (0)