https://github.com/ampproject/bento-compiler
Server-render AMP Components with worker-dom
https://github.com/ampproject/bento-compiler
Last synced: 11 months ago
JSON representation
Server-render AMP Components with worker-dom
- Host: GitHub
- URL: https://github.com/ampproject/bento-compiler
- Owner: ampproject
- License: apache-2.0
- Created: 2021-07-23T19:09:54.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2025-02-22T05:23:28.000Z (over 1 year ago)
- Last Synced: 2025-02-22T06:24:10.502Z (over 1 year ago)
- Language: HTML
- Homepage:
- Size: 1.44 MB
- Stars: 9
- Watchers: 5
- Forks: 3
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Bento Compiler
Server-render AMP Components with [worker-dom](https://github.com/ampproject/worker-dom).
## Install
```bash
$ npm install --save @ampproject/bento-compiler
```
## Usage
> Visit the [test cases](./test/test-index.ts) for more info.
```js
import {renderAst} from '@ampproject/bento-compiler';
function ampLayoutBuildDom(element) {
element.setAttribute('i-amphtml-ssr', '');
}
const ast = h('html', {}, [h('body', {}, [h('amp-layout'))])]);
const rendered = renderAst(ast, {'amp-layout': ampLayoutBuildDom});
```
## Analysis
See the [analysis](go/bento-compiler-p1) for details on how we measured expected performance improvement.