mirror of
https://github.com/c8r/x0.git
synced 2024-09-11 21:57:26 +03:00
Merge defaultProps in static render
This commit is contained in:
parent
be47b0ba56
commit
3b4ca8510f
@ -129,7 +129,8 @@ App.defaultProps = {
|
||||
'Routing with react-router',
|
||||
'Works with CSS-in-JS libraries like styled-components',
|
||||
'Support for async data fetching',
|
||||
]
|
||||
],
|
||||
// routes: [ '/', '/hello', '/hi' ]
|
||||
}
|
||||
|
||||
App.getInitialProps = async ({ Component, html, pathname }) => {
|
||||
@ -138,7 +139,7 @@ App.getInitialProps = async ({ Component, html, pathname }) => {
|
||||
|
||||
return {
|
||||
hello: 'hi',
|
||||
css,
|
||||
css
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,10 +82,12 @@ const writePage = async (Component, options) => {
|
||||
return html
|
||||
}
|
||||
|
||||
const createStatic = async (filename, options) => {
|
||||
const createStatic = async (filename, baseOptions) => {
|
||||
const req = require(filename)
|
||||
const Component = req.default || req
|
||||
|
||||
const options = Object.assign({}, Component.defaultProps, baseOptions)
|
||||
|
||||
let html
|
||||
if (options.routes && options.routes.length) {
|
||||
html = await options.routes.map(async pathname => {
|
||||
|
@ -49,10 +49,7 @@
|
||||
},
|
||||
"x0": {
|
||||
"title": "Compositor x0",
|
||||
"_basename": "/x0",
|
||||
"routes": [
|
||||
"/"
|
||||
]
|
||||
"_basename": "/x0"
|
||||
},
|
||||
"ava": {
|
||||
"files": [
|
||||
|
Loading…
Reference in New Issue
Block a user