/gatsby-starter-oneweek

gatsby starter by 2-one-week

Primary LanguageTypeScriptBSD Zero Clause License0BSD

gatsby-starter-oneweek

Netlify Status

English README ๐Ÿ‡บ๐Ÿ‡ธ

์ด Gatsby Starter์—๋Š”...

  • ๐Ÿ’„ gatsby-remark-highlight-code๋ฅผ ํ†ตํ•œ ์ปค์Šคํ…€ํ•œ ์ฝ”๋“œ ํ•˜์ด๋ผ์ดํŒ… ๊ธฐ๋Šฅ
  • ๐Ÿ’ฌ utterances ๋Œ“๊ธ€ ๊ธฐ๋Šฅ ์ง€์›
  • โ˜• 'Buy me a coffee' ๋ผ๋Š” ํ›„์› ๊ธฐ๋Šฅ
  • ๐Ÿค– Google Analytics ์ง€์›
  • โš™ ๋ณ„๋„ ์„ค์ • ํŒŒ์ผ์„ ํ†ตํ•œ ๋ธ”๋กœ๊ทธ ์„ธ๋ถ€ ์‚ฌํ•ญ ์„ค์ • ์ง€์›
  • TypeScript๋ฅผ ์‚ฌ์šฉ
  • ๋””์ž์ธ์€ Velog์™€ ํ•œ์žฌ์—ฝ๋‹˜์˜ gatsby-starter-bee์—์„œ ์˜๊ฐ์„ ๋ฐ›์•„ ์ œ์ž‘ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

Gatsby site์˜ ์ •์ฑ…์— ์˜ํ•ด ์•„์ง starter๋กœ ๋“ฑ๋กํ•˜์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค.

Demo ์‚ฌ์ดํŠธ (netlify)

Use case

์ด ํ…œํ”Œ๋ฆฟ์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ธ”๋กœ๊ทธ๋ฅผ ๋งŒ๋“ค์—ˆ๋‹ค๋ฉด ์œ„ '์‚ฌ์šฉํ•œ ๋ธ”๋กœ๊ทธ' ๋ฆฌ์ŠคํŠธ์— ์ถ”๊ฐ€ํ•ด์ฃผ์„ธ์š”! PR์„ ํ†ตํ•ด ๋“ฑ๋กํ•ด์ฃผ์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค!

๐Ÿ˜Ž Quick Start

1. Gatsby ํ”„๋กœ์ ํŠธ๋ฅผ ์‹œ์ž‘

# ์ด ๋ธ”๋กœ๊ทธ ์Šคํƒ€ํ„ฐ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ gatsby ํ”„๋กœ์ ํŠธ๋ฅผ ์‹œ์ž‘ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
npx gatsby new my-blog-starter https://github.com/2-one-week/gatsby-starter-oneweek.git

๋งŒ์•ฝ npx๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์ง€ ์•Š๋Š”๋‹ค๋ฉด, Gatsby Getting Started ๊ธ€์„ ์ฐธ๊ณ ํ•˜๊ฑฐ๋‚˜ ์•„๋ž˜ ์ปค๋งจ๋“œ๋ฅผ ์‹คํ–‰ํ•ด์ฃผ์„ธ์š”.

npm install -g gatsby-cli
gatsby new my-blog-starter https://github.com/2-one-week/gatsby-starter-oneweek.git

2. Dev server๋ฅผ ํ†ตํ•ด ๋กœ์ปฌ์—์„œ๋„ ์ ‘๊ทผ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

cd my-blog-starter/
npm start
# ๋ธŒ๋ผ์šฐ์ €์—์„œ localhost:8000๋กœ ์ ‘๊ทผ ๊ฐ€๋Šฅ

3. ํฌ์ŠคํŒ…์„ ์ถ”๊ฐ€ํ•˜์„ธ์š”

๋‹ค์Œ ๋‘ ๊ณณ์—์„œ ํฌ์ŠคํŒ…์„ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • ๋ธ”๋กœ๊ทธ ํฌ์ŠคํŒ…์€ content/blog ๋””๋ ‰ํ† ๋ฆฌ์— ์ถ”๊ฐ€ํ•ด์ฃผ์„ธ์š”.
    • ํด๋”๋ฅผ ๊ตฌ๋ถ„ํ•˜๋ฉด, ํ•ด๋‹น ํด๋”๋กœ routing ๋ฉ๋‹ˆ๋‹ค.
  • ์›น์— ์˜ฌ๋ ค๋‘˜ ์ด๋ ฅ์„œ๋Š” content/__about ๋””๋ ‰ํ† ๋ฆฌ์— ์ถ”๊ฐ€ํ•ด์ฃผ์„ธ์š”.

๋ช‡ ๊ฐ€์ง€์˜ ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ์™€ ๋งˆํฌ๋‹ค์šด ๋ฌธ๋ฒ•์œผ๋กœ ํฌ์ŠคํŒ…์„ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

4. ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ ์ˆ˜์ •

/gatsby-user-config.js ํŒŒ์ผ์—์„œ ์‚ฌ์šฉ์ž์— ๋”ฐ๋ฅธ ๋ธ”๋กœ๊ทธ๋ฅผ ์„ค์ •ํ•˜๋Š” ์—ฌ๋Ÿฌ ์š”์†Œ๋ฅผ ์ˆ˜์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

5. Netlify๋กœ ๋ฐฐํฌ

Netlify Status

๐Ÿ’ก github pages๋ฅผ ํ†ตํ•ด ๋ฐฐํฌํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด ์•„๋ž˜ npm script๋ฅผ package.json์— ์ถ”๊ฐ€ํ•ด์ฃผ์„ธ์š”.

"scripts": {
    "deploy": "gatsby build && gh-pages -d public -b master -r 'git@github.com:${your github id}/${github page name}.github.io.git'"
}

gh-pages ๋ชจ๋“ˆ์ด ํ•„์š”ํ•  ๊ฒฝ์šฐ ์„ค์น˜๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

์‚ฌ์šฉ์ž์— ๋”ฐ๋ผ ๋ฐ”๊พธ๊ธฐ

โš™ ์„ค์ •

/root
โ”œโ”€โ”€ gatsby-config.js // Gatsby config
โ”œโ”€โ”€ gatsby-user-config.js // Template config by user
โ””โ”€โ”€ gatsby-node.js // Gatsby Node config

โ›‘ ๊ตฌ์กฐ

src
โ”œโ”€โ”€ components // ์—ฌ๋Ÿฌ๊ณณ์—์„œ ์‚ฌ์šฉํ•˜๋Š” ๊ณตํ†ต ์ปดํฌ๋„ŒํŠธ๋“ค
โ”œโ”€โ”€ pages // ๊ธฐ๋ณธ ํŽ˜์ด์ง€ routing post: /(home), /about, /category
โ”œโ”€โ”€ styles
โ”‚   โ”œโ”€โ”€ global-style.ts // styled compoenents์—์„œ ์‚ฌ์šฉํ•  global style
โ”‚   โ””โ”€โ”€ theme.ts // styled compoenents theme
โ””โ”€โ”€ containers
    โ”œโ”€โ”€ post.tsx
    โ”‚   โ”œโ”€โ”€ components // post ํŽ˜์ด์ง€๋งŒ์„ ์œ„ํ•œ component๋“ค
    โ”‚   โ””โ”€โ”€ index.tsx // 
    โ””โ”€โ”€ layout.tsx // home, post, resume layout

๐ŸŽจ ์Šคํƒ€์ผ

gatsby-user-config ์ˆ˜์ •์„ ํ†ตํ•ด main color๋ฅผ ๋ฐ”๊ฟ€ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

{
  ...
  mainColor: `color what you want`
  ...
}

๐Ÿญ ๊ฟ€ํŒ

  • ํ”„๋กœํ•„ ์‚ฌ์ง„! (replace file in /contents/assets/profile.png)
  • ํŒŒ๋น„์ฝ˜ ์ด๋ฏธ์ง€! (replace file in /contents/assets/favicon.png)
  • ๋ธ”๋กœ๊ทธ ์‚ฌ์ดํŠธ Default Meta ์ด๋ฏธ์ง€! (replace file in /contents/assets/default.png)
  • Utterances๋ฅผ ์œ„ํ•œ repository๋ฅผ ์„ค์ •ํ•ด์ฃผ์„ธ์š”! (/gatsby-user-config.js์˜ repository ์ฃผ์†Œ๋ฅผ ๊ต์ฒดํ•ด์ฃผ์„ธ์š”.)
    • โš ๏ธ ์ด ๊ฐ€์ด๋“œ๋ฅผ ๊ผญ ํ™•์ธํ•ด์ฃผ์„ธ์š”.

โ˜• ๋งˆ์Œ์— ๋“œ์…จ๋‚˜์š”?

์ปคํ”ผ ํ•œ์ž”?

๐Ÿ› ๋ฒ„๊ทธ์ œ๋ณด

Issue

๐ŸŽ ๊ธฐ์—ฌํ•˜๊ธฐ

Contributing guide

LICENSE

MIT

Project by @2-one-week