1
1
mirror of https://github.com/c8r/x0.git synced 2024-09-11 21:57:26 +03:00

Render to body

This commit is contained in:
Brent Jackson 2017-12-07 16:34:07 -05:00
parent 75159f1573
commit a842d21652
7 changed files with 14 additions and 12 deletions

View File

@ -19,7 +19,6 @@ import BtnOutline from './BtnOutline'
import Tweet from './Tweet'
const App = connect(props => <React.Fragment>
<head>
<title>{props.title}</title>
<meta name='description' content={props.description} />
<meta name='twitter:card' content='summary' />
@ -28,8 +27,6 @@ const App = connect(props => <React.Fragment>
<meta name='twitter:title' content={props.description} />
<meta name='twitter:image' content='https://compositor.io/logo/dist/compositor-black.png' />
<Style />
</head>
<body>
<Container>
<nav>
<Flex wrap align='center'>
@ -118,12 +115,13 @@ const App = connect(props => <React.Fragment>
</footer>
</main>
</Container>
{/*
<script
dangerouslySetInnerHTML={{
__html: scripts
}}
/>
</body>
*/}
</React.Fragment>)
App.defaultProps = {

View File

@ -10,7 +10,7 @@ const Style = ({ css = '' }) => (
const base = `
*{box-sizing:border-box}
body {
:root {
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
line-height: 1.5;
min-height: 100vh;

View File

@ -1,6 +1,5 @@
<!DOCTYPE html>
<meta charset='utf-8'>
<title>Hello</title><h1>Beep <!-- -->0</h1><a class="twitter-share-button" href="https://twitter.com/intent/tweet">Tweet</a><button>+</button>
<meta charset='utf-8'>
<title>Hello <!-- -->0</title><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="description" content="Description for this page"/><h1 class="sc-bdVaJa ewjoPu">Hello <!-- -->0</h1><button>+</button>
<script id='__initial-props__' type='application/json'>{"count":0,"title":"Compositor x0","_basename":"/x0","d":"docs","outDir":"docs"}</script>
<script src='/bundle.js'></script>

View File

@ -2,7 +2,7 @@ const React = require('react')
const { render } = require('react-dom')
const App = require('./App')
const div = typeof APP !== 'undefined' ? APP : document.documentElement
const div = typeof APP !== 'undefined' ? APP : document.body
const id = require.resolve(COMPONENT)
const req = require(COMPONENT)

View File

@ -6,7 +6,7 @@ const App = require(COMPONENT).default || require(COMPONENT)
const data = document.getElementById('__initial-props__').innerHTML
const props = JSON.parse(data)
const div = typeof APP !== 'undefined' ? APP : document.documentElement
const div = typeof APP !== 'undefined' ? APP : document.body
hydrate(
React.createElement(App, props),

View File

@ -20,8 +20,12 @@ const createHTML = ({
initialProps,
scripts = []
}) => (`<!DOCTYPE html>
<meta charset='utf-8'>
<head>
<meta charset='utf-8'>
</head>
<body>
${body}
</body>
${initialProps ? `<script id='__initial-props__' type='application/json'>${JSON.stringify(initialProps)}</script>` : ''}
${scripts.map(src => `<script src='${src}'></script>`)}
`)

View File

@ -1,6 +1,6 @@
{
"name": "@compositor/x0",
"version": "3.0.0-4",
"version": "3.0.0-5",
"description": "Zero-config React development environment and static site generator",
"main": "index.js",
"bin": {
@ -47,6 +47,7 @@
"nano-style": "^1.0.0-20",
"nyc": "^11.2.1",
"refunk": "^2.0.0-1",
"styled-components": "^2.2.4",
"styled-system": "^1.0.7"
},
"x0": {