npm install
npm start
Last active
February 6, 2020 06:56
-
-
Save FND/c75c9522e7bc33605c8b65c24574c85a to your computer and use it in GitHub Desktop.
minimal complate sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/node_modules | |
/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createElement } from "complate-stream"; | |
export function Card({ title }, ...children) { | |
return <article class="card"> | |
<h3>{title}</h3> | |
{children} | |
</article>; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
module.exports = { | |
js: [{ | |
source: "./index.js", | |
target: "./dist/bundle.js", | |
jsx: { pragma: "createElement" } | |
}] | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { SampleView } from "./views.jsx"; | |
import Renderer from "complate-stream"; | |
import BufferedStream from "complate-stream/src/buffered-stream.js"; | |
let { renderView } = new Renderer(); | |
let stream = new BufferedStream(); | |
renderView(SampleView, { title: "Hello World" }, stream, {}, () => { | |
let html = stream.read(); | |
console.log(html); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"start": "npm run compile && node dist/bundle.js", | |
"compile": "faucet" | |
}, | |
"dependencies": { | |
"complate-stream": "^0.16.9" | |
}, | |
"devDependencies": { | |
"faucet-pipeline-jsx": "^2.0.10" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Card } from "./components.jsx"; | |
import { createElement } from "complate-stream"; | |
export function SampleView() { | |
return <Card title="Hello World"> | |
<p>lorem ipsum dolor sit amet</p> | |
</Card>; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment