Created
September 11, 2018 10:26
-
-
Save FND/29305de381761b30496c0a16634f1d96 to your computer and use it in GitHub Desktop.
complate string rendering
This file contains hidden or 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 hidden or 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 hidden or 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 { MyMacro } from "./macros"; | |
import { createElement } from "complate-stream"; | |
import BufferedStream from "complate-stream/src/buffered-stream"; | |
let stream = new BufferedStream(); | |
let el = createElement(MyMacro, { title: "Hello World" }); | |
el(stream, { nonBlocking: true }, () => { | |
let html = stream.read(); | |
console.log(html); | |
}); |
This file contains hidden or 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 MyMacro({ title }, ...children) { | |
return <article class="sample"> | |
<h2>{title}</h2> | |
{children} | |
</article>; | |
} |
This file contains hidden or 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": {}, | |
"devDependencies": { | |
"complate-stream": "^0.16.4", | |
"faucet-pipeline-jsx": "^1.0.0-rc.11" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment