mirror of
https://github.com/c8r/x0.git
synced 2024-09-19 09:38:31 +03:00
Merge pull request #16 from c8r/merge-default-props
Merge defaultProps in static render
This commit is contained in:
commit
3bee61ef20
@ -138,7 +138,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