Created
April 21, 2020 14:43
-
-
Save xthezealot/434c6ac5d8b637ec02821687ae3782fd to your computer and use it in GitHub Desktop.
React configurations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Gatsby + Ant Design + Less | |
// gatsby-config.js plugins | |
{ | |
resolve: `gatsby-plugin-less`, | |
options: { | |
javascriptEnabled: true, | |
modifyVars: { | |
hack: `true; @import "${__dirname}/src/components/antd.less";`, | |
}, | |
}, | |
}, | |
// .babelrc | |
{ | |
"presets": [["babel-preset-gatsby"]], | |
"plugins": [ | |
[ | |
"import", | |
{ "libraryName": "antd", "libraryDirectory": "es", "style": true } | |
] | |
] | |
} | |
// src/components/antd.less | |
@font-size-base: 16px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// React + UIkit | |
import React, { useEffect } from 'react' | |
import PropTypes from 'prop-types' | |
const Layout = ({ children }) => { | |
useEffect(() => { | |
;(async (x) => { | |
const UIkit = (await import('uikit/dist/js/uikit.js')).default | |
const Icons = (await import('uikit/dist/js/uikit-icons.js')).default | |
UIkit.use(Icons) | |
})() | |
}) | |
return ( | |
<> | |
<main>{children}</main> | |
</> | |
) | |
} | |
Layout.propTypes = { | |
children: PropTypes.node.isRequired, | |
} | |
export default Layout |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment