node-stream-string
1.0.1 • Public • Published node-stream-string
Streamed ES6 template literal function.
Motivation
Written for using renderToNodeStream
React SSR function with ES6 template literals.
Install
npm i --save node-stream-string
Usage
const streamString = require('node-stream-string')
app.get("/", (req, res) => {
const stream = streamString`
<!DOCTYPE html>
<html>
<head>
<title>${ getTitle(req) }</title>
<style>${ getStyle(req) }</style>
</head>
<body>
<div id='root'>
${ renderToNodeStream(<App/>) }
</div>
</body>
</html>
`
stream.pipe(res)
})
License
MIT
Versions
Current Tags
Version | Downloads (Last 7 Days) | Tag |
---|
1.0.1 | 74 | latest |
Version History
Version | Downloads (Last 7 Days) | Published |
---|
1.0.1 | 74 | |
1.0.0 | 0 | |
Package Sidebar
Install
Weekly Downloads