Feature/build step (#2)

* BundleAnalyzerPlugin

* lazy load highlight.js

* seperate bundles for each page

* prerender apps to html on build

* preload important font files

* dont prerender code copy button

* fix woff2 variant of font

* added missing doctype

* remove metatags component
This commit is contained in:
August Skare
2018-10-19 15:02:15 +01:00
committed by GitHub
parent 30f7f83573
commit 580e574c84
23 changed files with 666 additions and 170 deletions

View File

@@ -68,8 +68,8 @@ class Code extends React.Component<CodeProps, CodeState> {
const { language, children } = this.props;
if (language !== undefined) {
const { highlight } = await import(/* webpackChunkName: 'highlight.js' */ 'highlight.js');
const { value: hlCode } = highlight(language, children as string);
const { default: hljs } = await System.import(/* webpackChunkName: 'highlightjs' */ 'ts/highlight');
const { value: hlCode } = hljs.highlight(language, children as string);
this.setState({ hlCode });
}
}
@@ -102,7 +102,7 @@ class Code extends React.Component<CodeProps, CodeState> {
<StyledCode>{this.props.children}</StyledCode>
)}
</StyledPre>
<Button onClick={this.handleCopy}>Copy</Button>
{navigator.userAgent !== 'ReactSnap' ? <Button onClick={this.handleCopy}>Copy</Button> : null}
{!('clipboard' in navigator) ? (
<CopyInput readOnly aria-hidden="true" ref={this.code} value={children} />
) : null}