rickvanlieshout.com/gatsby/on-render-body.js

23 lines
590 B
JavaScript
Raw Normal View History

2019-07-19 19:42:20 +02:00
'use strict';
const React = require('react');
const siteConfig = require('../config.js');
// eslint-disable-next-line import/no-webpack-loader-syntax, import/no-unresolved
const katexStylesheet = require('!css-loader!../static/css/katex/katex.min.css');
const onRenderBody = ({ setHeadComponents }) => {
const { useKatex } = siteConfig;
if (useKatex) {
setHeadComponents([
React.createElement('style', {
key: 'katex-inline-stylesheet',
dangerouslySetInnerHTML: { __html: katexStylesheet.toString() }
})
]);
}
};
module.exports = onRenderBody;