Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const getFela = (Component, props) => {
if (!props.renderer) {
console.log('Warning: Fela static rendering requires a `renderer` to be passed through the `getInitialProps()` method.')
return ''
}
const fela = require('fela')
const felaDOM = require('fela-dom')
const renderer = props.renderer || fela.createRenderer()
renderToString(
React.createElement(Component, props)
)
const tag = felaDOM.renderToMarkup(renderer)
return tag
}
app.get('/', (req, res) => {
const renderer = createRenderer()
const indexHTML = fs.readFileSync(`${__dirname}/index.html`).toString()
const appHtml = renderToString(
)
const appCSS = renderToMarkup(renderer)
res.write(
indexHTML
.replace('', appHtml)
.replace('', appCSS)
)
res.end()
})
app.get('/', (req, res) => {
const renderer = createRenderer()
const indexHTML = fs.readFileSync(`${__dirname}/index.html`).toString()
const appHtml = renderToString(
)
const appCSS = renderToMarkup(renderer)
res.write(indexHTML.replace('', appHtml).replace('', appCSS))
res.end()
})
app.get('/', (req, res) => {
const renderer = createRenderer()
const indexHTML = fs.readFileSync(`${__dirname}/index.html`).toString()
const appHtml = render(
)
const appCSS = renderToMarkup(renderer)
res.write(indexHTML.replace('', appHtml).replace('', appCSS))
res.end()
})