mirror of
https://github.com/c8r/x0.git
synced 2024-09-11 13:45:52 +03:00
Remove helmet
This commit is contained in:
parent
fd207eb0a7
commit
a6e3e8f10e
@ -370,7 +370,6 @@ See the [example](https://github.com/c8r/x0/tree/master/examples/webpack-config)
|
|||||||
|
|
||||||
- [ ] pass RouterState props to view
|
- [ ] pass RouterState props to view
|
||||||
- [ ] props.Component/children in custom apps
|
- [ ] props.Component/children in custom apps
|
||||||
- [ ] Head component with react helmet
|
|
||||||
- [ ] changelog/docs
|
- [ ] changelog/docs
|
||||||
- [x] require.context `_app`
|
- [x] require.context `_app`
|
||||||
- [x] peer deps
|
- [x] peer deps
|
||||||
@ -384,6 +383,7 @@ See the [example](https://github.com/c8r/x0/tree/master/examples/webpack-config)
|
|||||||
- [x] minimatch
|
- [x] minimatch
|
||||||
- [x] move client modules to src
|
- [x] move client modules to src
|
||||||
- [x] adjust resolve
|
- [x] adjust resolve
|
||||||
|
- [ ] ~~Head component with react helmet~~ doesn't work
|
||||||
|
|
||||||
### Breaking
|
### Breaking
|
||||||
|
|
||||||
|
20
docs/_app.js
20
docs/_app.js
@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import * as scope from 'rebass'
|
import * as scope from 'rebass'
|
||||||
import { Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
import { ScopeProvider, Head } from '../components'
|
import { ScopeProvider } from '../components'
|
||||||
import {
|
import {
|
||||||
Flex,
|
Flex,
|
||||||
Box,
|
Box,
|
||||||
@ -15,19 +15,19 @@ export default class App extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { routes, route, render } = this.props
|
const {
|
||||||
|
routes,
|
||||||
// return render()
|
route,
|
||||||
|
children,
|
||||||
|
// alternative to props.children
|
||||||
|
render,
|
||||||
|
} = this.props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScopeProvider scope={scope}>
|
<ScopeProvider scope={scope}>
|
||||||
<Head>
|
|
||||||
<title>hello</title>
|
|
||||||
<meta name='twitter:card' content='summary' />
|
|
||||||
</Head>
|
|
||||||
{false ? (
|
{false ? (
|
||||||
<Layout>
|
<Layout>
|
||||||
{render()}
|
{children}
|
||||||
</Layout>
|
</Layout>
|
||||||
) : (
|
) : (
|
||||||
<Flex>
|
<Flex>
|
||||||
@ -44,7 +44,7 @@ export default class App extends React.Component {
|
|||||||
</Box>
|
</Box>
|
||||||
<Box width={1} p={3}>
|
<Box width={1} p={3}>
|
||||||
<Container maxWidth={768}>
|
<Container maxWidth={768}>
|
||||||
{render()}
|
{children}
|
||||||
</Container>
|
</Container>
|
||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
18
lib/build.js
18
lib/build.js
@ -7,7 +7,6 @@ const merge = require('webpack-merge')
|
|||||||
const React = require('react')
|
const React = require('react')
|
||||||
const { renderToString, renderToStaticMarkup } = require('react-dom/server')
|
const { renderToString, renderToStaticMarkup } = require('react-dom/server')
|
||||||
const { StaticRouter } = require('react-router-dom')
|
const { StaticRouter } = require('react-router-dom')
|
||||||
const { Helmet } = require('react-helmet')
|
|
||||||
const semver = require('semver')
|
const semver = require('semver')
|
||||||
|
|
||||||
const util = require('util')
|
const util = require('util')
|
||||||
@ -90,7 +89,8 @@ const renderHTML = ({
|
|||||||
const sheet = new ServerStyleSheet()
|
const sheet = new ServerStyleSheet()
|
||||||
html = render(
|
html = render(
|
||||||
sheet.collectStyles(
|
sheet.collectStyles(
|
||||||
React.createElement(App.default, { routes, path })
|
app
|
||||||
|
// React.createElement(App.default, { routes, path })
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
css = sheet.getStyleTags()
|
css = sheet.getStyleTags()
|
||||||
@ -114,23 +114,9 @@ const renderHTML = ({
|
|||||||
html = render(app)
|
html = render(app)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
const helmet = Helmet.renderStatic()
|
|
||||||
const head = parseHelmet(helmet)
|
|
||||||
// doesn't seem to be working...
|
|
||||||
// console.log('head', head)
|
|
||||||
return { html, css, path, props }
|
return { html, css, path, props }
|
||||||
}
|
}
|
||||||
|
|
||||||
const parseHelmet = helmet => [
|
|
||||||
helmet.title.toString(),
|
|
||||||
helmet.link.toString(),
|
|
||||||
helmet.meta.toString(),
|
|
||||||
helmet.script.toString(),
|
|
||||||
helmet.noscript.toString(),
|
|
||||||
helmet.style.toString(),
|
|
||||||
helmet.base.toString(),
|
|
||||||
].filter(n => !!n && n.length).join('\n')
|
|
||||||
|
|
||||||
const remove = filename => {
|
const remove = filename => {
|
||||||
fs.remove(filename, err => {
|
fs.remove(filename, err => {
|
||||||
if (err) console.log(err)
|
if (err) console.log(err)
|
||||||
|
@ -59,7 +59,6 @@
|
|||||||
"react": "^16.4.1",
|
"react": "^16.4.1",
|
||||||
"react-dev-utils": "^5.0.1",
|
"react-dev-utils": "^5.0.1",
|
||||||
"react-dom": "^16.4.1",
|
"react-dom": "^16.4.1",
|
||||||
"react-helmet": "^5.2.0",
|
|
||||||
"react-live": "^1.10.1",
|
"react-live": "^1.10.1",
|
||||||
"react-router": "^4.3.1",
|
"react-router": "^4.3.1",
|
||||||
"react-router-dom": "^4.3.1",
|
"react-router-dom": "^4.3.1",
|
||||||
@ -72,11 +71,11 @@
|
|||||||
"remark-slug": "^5.0.0",
|
"remark-slug": "^5.0.0",
|
||||||
"semver": "^5.5.0",
|
"semver": "^5.5.0",
|
||||||
"stringify-object": "^3.2.2",
|
"stringify-object": "^3.2.2",
|
||||||
|
"styled-system": "^2.3.1",
|
||||||
"update-notifier": "^2.5.0",
|
"update-notifier": "^2.5.0",
|
||||||
"webpack": "^4.10.2",
|
"webpack": "^4.10.2",
|
||||||
"webpack-merge": "^4.1.3",
|
"webpack-merge": "^4.1.3",
|
||||||
"webpack-serve": "^1.0.4",
|
"webpack-serve": "^1.0.4"
|
||||||
"styled-system": "^2.3.1"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@compositor/logo": "^1.4.0",
|
"@compositor/logo": "^1.4.0",
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
export { Helmet as default } from 'react-helmet'
|
|
||||||
|
|
||||||
// only needed if customizing api
|
|
||||||
// import React from 'react'
|
|
||||||
// import { Helmet } from 'react-helmet'
|
|
||||||
// export default props =>
|
|
||||||
// <Helmet {...props} />
|
|
41
src/entry.js
41
src/entry.js
@ -119,6 +119,26 @@ export default class Root extends React.Component {
|
|||||||
path = '/'
|
path = '/'
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
|
const render = appProps => (
|
||||||
|
routes.map(({ Component, ...route }) => (
|
||||||
|
<Route
|
||||||
|
{...route}
|
||||||
|
render={props => (
|
||||||
|
<Catch>
|
||||||
|
<CenteredLayout
|
||||||
|
active={/md/.test(route.extname)}>
|
||||||
|
<Component
|
||||||
|
{...props}
|
||||||
|
{...appProps}
|
||||||
|
{...route.props}
|
||||||
|
/>
|
||||||
|
</CenteredLayout>
|
||||||
|
</Catch>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Router
|
<Router
|
||||||
context={{}}
|
context={{}}
|
||||||
@ -134,25 +154,8 @@ export default class Root extends React.Component {
|
|||||||
<App
|
<App
|
||||||
{...router}
|
{...router}
|
||||||
routes={routes}
|
routes={routes}
|
||||||
render={appProps => (
|
render={render}
|
||||||
routes.map(({ Component, ...route }) => (
|
children={render()}
|
||||||
<Route
|
|
||||||
{...route}
|
|
||||||
render={props => (
|
|
||||||
<Catch>
|
|
||||||
<CenteredLayout
|
|
||||||
active={/md/.test(route.extname)}>
|
|
||||||
<Component
|
|
||||||
{...props}
|
|
||||||
{...appProps}
|
|
||||||
{...route.props}
|
|
||||||
/>
|
|
||||||
</CenteredLayout>
|
|
||||||
</Catch>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
))
|
|
||||||
)}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
export { Link, NavLink } from 'react-router-dom'
|
export { Link, NavLink } from 'react-router-dom'
|
||||||
export { default as ScopeProvider } from './ScopeProvider'
|
export { default as ScopeProvider } from './ScopeProvider'
|
||||||
export { default as Head } from './Head'
|
|
||||||
export { default as LiveEditor } from './LiveEditor'
|
export { default as LiveEditor } from './LiveEditor'
|
||||||
export { default as LivePreview } from './LivePreview'
|
export { default as LivePreview } from './LivePreview'
|
||||||
export { default as FileList } from './FileList'
|
export { default as FileList } from './FileList'
|
||||||
|
Loading…
Reference in New Issue
Block a user