gatsby - GatsbyJS Typography 插件的 css 被覆盖
问题描述
我有一个带有 TypographyJS(通过 Gatsby 插件)和 Ant Design UI 框架的 GatsbyJS 应用程序。排版插件是在官方文档之后添加的,here
要使 ant design CSS 工作,您必须gatsby-browser.js
根据他们的文档在文件中导入 ant design css,这里
ant design css 覆盖了排版插件样式。我想将 ant 设计样式与字体等的排版结合使用。
盖茨比浏览器.js
/**
* Implement Gatsby's Browser APIs in this file.
*
* See: https://www.gatsbyjs.org/docs/browser-apis/
*/
// You can delete this file if you're not using it
import 'antd/dist/antd.css'
排版.js
import Typography from "typography"
import fairyGateTheme from "typography-theme-fairy-gates"
/**
* Issue:
* Fairy Gates Theme: Messed up text shadow in default starter project header
*
* Solution:
* https://github.com/KyleAMathews/typography.js/issues/155#issuecomment-490715480
*/
fairyGateTheme.overrideThemeStyles = () => ({
a: {
textShadow: `none`,
backgroundImage: `none`,
},
});
const typography = new Typography(fairyGateTheme)
export const { scale, rhythm, options } = typography
export default typography
解决方案
推荐阅读
- jstree - JSTree拖放检查回调
- bash - 为什么我的 bash 循环生成 $i-$j_filename 不适用于内部循环,所以我只能得到四个文件(1-4_filename、2-4_filename、...)?
- python - 命令“python3 -m pip install [...]”失败,错误代码 1 为无
- xcode11 - 为 Xcode SPM 测试复制资源文件
- php - 如何使用 PHP(ImageMagick)降低动画 gif 的质量(文件大小)?
- python - 如何使用 wget 下载文件?[解决了]
- go - net.Listen 在 linux/mipsle 上返回 errno -89
- java - 计算最大心率的 IF else 语句
- google-cloud-platform - 使用 GCE 或 GKE 的私有 IP 连接到 Cloud SQL
- reactjs - 使用高阶组件传递属性