๐Ÿงน ๊ธฐ๋ณธ ์„ธํŒ… ๐Ÿงน

๋ฐ•์ƒ์€ยท2022๋…„ 6์›” 13์ผ
0

๐Ÿ‘‡ ๋ชฉ์ 

ํฌํŠธํด๋ฆฌ์˜ค๋ฅผ ๋‹จ์ˆœํžˆ ํ…์ŠคํŠธ๋กœ ์ฝ๊ธฐ๋ณด๋‹ค๋Š” ์›น ํ”„๋ก ํŠธ์—”๋“œ ๊ฐœ๋ฐœ์ž์ธ ๋งŒํผ ์›นํŽ˜์ด์ง€๋กœ ๋งŒ๋“ค์–ด์„œ ๋ฐฐํฌํ•˜๊ณ  ๊ฒ€์ƒ‰์—”์ง„์— ์˜ํ•ด ๊ฒ€์ƒ‰๋˜๋„๋ก ๋งŒ๋“ค์–ด๋ณด๊ณ  ์‹ถ์–ด์„œ ๊ฐœ๋ฐœ์„ ์‹œ์ž‘ํ–ˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ’โ€โ™‚๏ธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์„ ํƒ๊ณผ ์ด์œ 

1. Next.js

์ฃผ ๋ชฉ์ ์€ SEO๋ฅผ ์œ„ํ•ด์„œ๊ณ  ์ถ”๊ฐ€์ ์œผ๋กœ ๊ฐ์ข… ํŽธ์˜ ๊ธฐ๋Šฅ๋“ค์„ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ ์„ ํƒํ–ˆ์Šต๋‹ˆ๋‹ค.

2. tailwindcss

์—ฌํƒœ๊นŒ์ง€ styled-components์™€ tailwindcss ๋‘ ๊ฐ€์ง€ ๋ฐ–์— ์‚ฌ์šฉํ•ด๋ณด์ง€ ์•Š์•˜์ง€๋งŒ tailwindcss๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด์„œ ๋Š๋‚€๊ฒŒ ์ด๊ฒƒ๋ณด๋‹ค ๋” ํŽธํ•˜๊ณ  ์‰ฝ๊ณ  ์ข‹์€ css๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ, ํ”„๋ ˆ์ž„์›Œํฌ๊ฐ€ ์—†์„๊ฑฐ๋ผ๋Š” ์ƒ๊ฐ์„ ํ–ˆ์„์ •๋„๋กœ ๋„ˆ๋ฌด ํŽธํ•˜๊ณ  ์ข‹์•„์„œ ์„ ํƒํ–ˆ์Šต๋‹ˆ๋‹ค.
์•ž์œผ๋กœ๋„ ํŠน๋ณ„ํ•œ ์ด์œ ๊ฐ€ ์—†๋‹ค๋ฉด tailwindcss๋ฅผ ์ด์šฉํ•  ์ƒ๊ฐ์ž…๋‹ˆ๋‹ค.

3. TypeScript

๊ฐœ๋ฐœ์„ ์ง„ํ–‰ํ•  ๋•Œ๋„ ๊ฐœ๋ฐœ ์™„๋ฃŒ ํ›„ ํ”„๋กœ์ ํŠธ๋ฅผ ๊ด€๋ฆฌํ•  ๋•Œ๋„ JavaScript๋ณด๋‹ค ๋” ํŽธํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์„ ํƒํ–ˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ‘ ์„ธํŒ…

1. tailwindcss

# ์„ค์น˜
npm i -D tailwindcss postcss autoprefixer

# postcss.config.js์™€ tailwind.config.js ์ƒ์„ฑ
npx tailwindcss init -p
  • tailwind.config.js์— ์•„๋ž˜ ๊ฐ’ ์ถ”๊ฐ€
module.exports = {
  content: ["./src/pages/**/*.{ts,tsx}", "./src/components/**/*.{ts,tsx}"],
}
  • globals.css( _app.tsx์—์„œ importํ•˜๋Š” cssํŒŒ์ผ ) ์ˆ˜์ •
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  /* ํฐํŠธ ์„ค์ • ( _document์—์„œ importํ•ด์ค€ ์ด๋ฆ„ ์‚ฌ์šฉ ) */
  html {
    font-family: 'Jua', sans-serif;
  }
  
  /* ์Šคํฌ๋กค ์ œ๊ฑฐ */
  body::-webkit-scrollbar {
    display: none
  }
}
  • ์ƒ‰์ƒ, ์ด๋ฏธ์ง€, ์• ๋‹ˆ๋ฉ”์ด์…˜ ์ ์šฉ๋ฒ•
module.exports = {
  // ... ์ƒ๋žต
  theme: {
    extend: {
      // ์ƒ‰์ƒ ๋“ฑ๋ก
      colors: {
        // ์›ํ•˜๋Š” ์ด๋ฆ„๊ณผ ์ƒ‰์ƒ ๋“ฑ๋ก ( ์ž๋™์™„์„ฑ๋จ )
        trello: "#1A76E3",
      },
      // ์ด๋ฏธ์ง€ ๋“ฑ๋ก
      backgroundImage: {
        // ์›ํ•˜๋Š” ์ด๋ฆ„๊ณผ ์ด๋ฏธ์ง€ ๊ฒฝ๋กœ ์ง€์ • ( ์ž๋™์™„์„ฑ๋จ )
        me: "url('/me.jpg')",
      },
      // ํ‚คํ”„๋ ˆ์ž„ ์ง€์ •
      keyframes: {
        "appear": {
          "0%": { opacity: 0 },
          "100%": { opacity: 1 },
        },
      },
      // ์• ๋‹ˆ๋ฉ”์ด์…˜ ๋“ฑ๋ก
      animation: {
        "appear": "appear 1.6s ease-in forwards",
      },
    },
  },
  plugins: [],
};

2. _document

import Document, { Head, Html, Main, NextScript } from "next/document";

class CustomDocument extends Document {
  render(): JSX.Element {
    return (
      <Html lang="ko">
        <Head>
          {/* ํŽ˜๋น„์ฝ˜ */}
          <link rel="shortcut icon" href="/favicon.ico" />

          {/* SEO */}
          <meta name="keyword" content="ํ”„๋ก ํŠธ์—”๋“œ, ํฌํŠธํด๋ฆฌ์˜ค" />
          <meta name="description" content="1-blue์˜ ํฌํŠธํด๋ฆฌ์˜ค" />

          {/* ์ž‘์„ฑ์ž */}
          <meta name="author" content="1-blue" />
          {/* ๋ฌธ์ž */}
          <meta httpEquiv="Content-Type" content="text/html; charset=utf-8" />

          {/* ์นด์นด์˜คํ†ก, ๋„ค์ด๋ฒ„ ๋ธ”๋กœ๊ทธ ๋ฏธ๋ฆฌ๋ณด๊ธฐ ์ œ๊ณตํ•  ์ •๋ณด */}
          <meta property="og:type" content="website" />
          <meta property="og:site_name" content="1-blue_portfolio" />
          <meta property="og:locale" content="ko_KR" />
          <meta property="og:image:width" content="1200" />
          <meta property="og:image:height" content="600" />
          <meta property="og:title" content="1-blue์˜ ํฌํŠธํด๋ฆฌ์˜ค" />
          <meta property="og:description" content="1-blue์˜ ํฌํŠธํด๋ฆฌ์˜ค" />
          <meta
            property="og:url"
            content={`https://${process.env.NEXT_PUBLIC_VERCEL_URL}`}
          />
          <meta
            property="og:image"
            content={`https://${process.env.NEXT_PUBLIC_VERCEL_URL}/me.jpg`}
          />

          {/* ๊ตฌ๊ธ€ ํฐํŠธ */}
          {/* "jua" - https://fonts.google.com/specimen/Jua?subset=korean#standard-styles */}
          <link
            href="https://fonts.googleapis.com/css2?family=Jua&display=swap"
            rel="stylesheet"
          />
        </Head>
        <body>
          <Main />
          <NextScript />
        </body>
      </Html>
    );
  }
}

export default CustomDocument;

3. ์ ˆ๋Œ€ ๊ฒฝ๋กœ ์ง€์ •

  • tsconfig.json
{
  "compilerOptions": {
    // ... ์ƒ๋žต
    "baseUrl": ".",
    "paths": {
      // ์—ฌ๊ธฐ์— ์›ํ•˜๋Š” ์ด๋ฆ„๊ณผ ์‹ค์ œ ๊ฒฝ๋กœ ๋“ฑ๋ก
      "@src/*": ["src/*"]
    }
  },
  // ... ์ƒ๋žต
}

0๊ฐœ์˜ ๋Œ“๊ธ€