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