@achilleskal/awesome-blog 中文文档教程
The smallest possible Gatsby theme
Quick Start
mkdir my-site
cd my-site
yarn init
# install gatsby-theme-minimal and it's dependencies
yarn add gatsby react react-dom gatsby-theme-minimal
然后将主题添加到您的 gatsby-config.js
。 我们将使用长格式 此处用于教育目的。
module.exports = {
plugins: [
{
resolve: "gatsby-theme-minimal",
options: {},
},
],
}
就是这样,您现在可以运行您的 gatsby 站点,
yarn gatsby develop
请注意该站点不做任何事情,因此您会看到缺少 资源错误。 在 src/pages/index.js
中创建一个简单的页面来查看 根 url 上的页面。
import React from "react"
export default () => <div>My Site!</div>
Doing more with themes
您可以将其用作开发主题的起点。 我 通常建议使用 yarn 工作区像 gatsby-theme-examples 回购 做, 但是使用 yarn link
或 npm link
是一个可行的选择,如果你是 不熟悉工作区。
The smallest possible Gatsby theme
Quick Start
mkdir my-site
cd my-site
yarn init
# install gatsby-theme-minimal and it's dependencies
yarn add gatsby react react-dom gatsby-theme-minimal
Then add the theme to your gatsby-config.js
. We'll use the long form here for education purposes.
module.exports = {
plugins: [
{
resolve: "gatsby-theme-minimal",
options: {},
},
],
}
That's it, you can now run your gatsby site using
yarn gatsby develop
Note that this site doesn't do anything, so you're see a missing resources error. Create a simple page in src/pages/index.js
to see a page on the root url.
import React from "react"
export default () => <div>My Site!</div>
Doing more with themes
You can use this as a place to start when developing themes. I generally suggest using yarn workspaces like the gatsby-theme-examples repo does, but using yarn link
or npm link
is a viable alternative if you're not familiar with workspaces.
你可能也喜欢
- @21epub/create-storybook-react-library 中文文档教程
- @4lch4/discord.js 中文文档教程
- @4tw/vue-drop-zone 中文文档教程
- @59naga/babel-plugin-transform-array-from 中文文档教程
- @7factor/react-native-form-builder 中文文档教程
- @a8k/html-loader 中文文档教程
- @aaas/config-encrypt 中文文档教程
- @ab-task/react-tool-belt 中文文档教程
- @abadri-test/consumer-b 中文文档教程
- @ably/bloomit 中文文档教程