0.2.4 • Published 3 years ago

gatsby-theme-zh v0.2.4

Weekly downloads
560
License
MIT
Repository
github
Last release
3 years ago

Gatsby Theme for zh ⚛

✨ Polished Gatsby theme for documentation site.

Usage

Create a Gatsby site from gatsby-starter-theme-zh.

$ yarn global add gatsby-cli // or npm install gatsby-cli -g
$ gatsby new mysite https://github.com/antvis/gatsby-starter-theme-zh

Start developing.

$ cd mysite
$ yarn start

gatsby-config.js

// gatsby-config.js
const { repository } = require('./package.json');

module.exports = {
  plugins: [
    {
      resolve: `gatsby-theme-zh`,
      options: {
        // pagesPath: './site/pages',
        pathPrefix: '/',
        // antd 主题:https://github.com/ant-design/ant-design/blob/master/components/style/themes/default.less
        theme: {
          'primary-color': '#873bf4',
        },
        pwa: true, // 是否开启 gatsby-plugin-offline
        cname: true, // 是否自动从 siteUrl 中提取 CNAME 文件
        codeSplit: true, // 是否开启 gatsby 按路由的代码分割,默认为 false
      },
    },
  ],
  siteMetadata: {
    title: `title`,
    description: `description`,
    githubUrl: repository.url,
    logoUrl: '', // 自定义 logo
    navs: [], // 用于定义顶部菜单
    docs: [], // 用于定义文档页面的二级分类菜单
    examples: [], // 用于定义演示页面的二级菜单,属性见下方
    showSearch: true, // 是否展示搜索框
    showChinaMirror: true, // 是否展示国内镜像链接
    showLanguageSwitcher: true, // 用于定义是否展示语言切换
    showAntVProductsCard: true, // 是否展示 AntV 系列产品的卡片链接
    showGithubCorner: true, // 是否展示角落的 GitHub 图标
    showChartResize: true, // 是否在demo页展示图表视图切换
    showAPIDoc: true, // 是否在demo页展示API文档
    playground: {
      container: '<canvas id="container" />', // 定义演示的渲染节点,默认 <div id="container" />
      playgroundDidMount: 'console.log("playgroundDidMount");',
      playgroundWillUnmount: 'console.log("playgroundWillUnmount");',
    },
    versions: [
      {
        '1.x': 'https://1x.ant.design',
        '2.x': 'https://2x.ant.design',
        '3.x': 'https://ant.design',
        '4.x': 'https://next.ant.design',
      },
    ],
    redirects: [
      {
        from: /\/old-url/,
        to: '/new-url', // 不指定 to 时直接跳转到 https://antv-2018.alipay.com/***
      },
    ],
  },
};

Develop

yarn install
yarn start

Visit https://localhost:8000 to preview.

Publish to npm

cd gatsby-theme-zh
npm run release

Deploy

npm run deploy

Set envoironment variable GATSBY_PATH_PREFIX to / in deploy service like netlify to preview pathPrefix site in root domain.

Add Dependency

cd gatsby-theme-zh
yarn add shallowequal

or

yarn workspace gatsby-theme-zh shallowequal
@ant-design/icons@babel/core@babel/plugin-transform-modules-umd@babel/preset-env@babel/preset-react@babel/preset-typescript@babel/standalone@hot-loader/react-dom@loadable/component@rstacruz/gatsby-remark-component@stackblitz/sdk@types/classnames@types/git-url-parse@types/gtag.js@types/loadable__component@types/lodash-es@types/parse-github-url@types/react@types/react-dom@types/react-helmet@types/react-slick@types/rehype-react@types/shallowequalantdaxiosbabel-preset-gatsbyclassnamescodesandboxdocsearch.jsgatsbygatsby-imagegatsby-plugin-antdgatsby-plugin-catch-linksgatsby-plugin-copy-filesgatsby-plugin-i18ngatsby-plugin-layoutgatsby-plugin-lessgatsby-plugin-manifestgatsby-plugin-meta-redirectgatsby-plugin-no-sourcemapsgatsby-plugin-nprogressgatsby-plugin-offlinegatsby-plugin-page-creatorgatsby-plugin-react-helmetgatsby-plugin-react-svggatsby-plugin-remove-serviceworkergatsby-plugin-remove-trailing-slashesgatsby-plugin-sitemapgatsby-plugin-typescriptgatsby-redirect-fromgatsby-remark-autolink-headersgatsby-remark-external-linksgatsby-remark-prismjsgatsby-remark-reading-timegatsby-source-filesystemgatsby-source-githubgatsby-transformer-remarkgit-url-parsehtml-to-imagei18nextindent-stringinsert-csslesslodashlodash-esmark.jsmatchmedia-polyfillmkdirpmonaco-editormonaco-editor-webpack-pluginnormalize.cssomit.jsprism-themesprismjsptz-i18nrc-drawerrc-footerreactreact-domreact-helmetreact-i18nextreact-monaco-editorreact-slickreact-split-panereact-test-rendererreact-userehype-reactrelease-itremark-rehypeshallowequalslashslick-carouseltypescriptvideo-react
0.2.4

3 years ago

0.2.3

3 years ago

0.2.1

3 years ago

0.2.2

3 years ago

0.2.0

3 years ago

0.1.20

3 years ago

0.1.19

3 years ago

0.1.17

3 years ago

0.1.18

3 years ago

0.1.13

3 years ago

0.1.14

3 years ago

0.1.15

3 years ago

0.1.16

3 years ago

0.1.11

3 years ago

0.1.12

3 years ago

0.1.10

3 years ago

0.1.8

3 years ago

0.1.9

3 years ago

0.1.7

3 years ago

0.1.5

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago