Code Monkey home page Code Monkey logo

sookdev's Introduction

😈 Sook Blog with Gatsby

Created blog based on [ {πŸ’Ž : react} , { πŸ’  : Typescript} , {πŸŒͺ : tailwind css} ]

Basic Install

/* step 1_install gatsby cli */
npm install -g gatsby-cli

/* step 2_Create gatsby project name on terminal */
gatsby new projectName

//! if you install gatsby without cli , use below code
npx gatsby-cli new projectName

Typescript Install ( optional )

/* step 3_Install typescript  */
yarn add typescript --dev
yarn add gatsby-plugin-typescript

//! if you apply typescript on your project, please follow below steps

/* step 4_Create tsconfig.json */
yarn tsc --init

/* step 5_Modify gatsby-config.js */
module.exports = {
  siteMetadata: {
    title: `Gatsby Default Starter`,
    description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`,
    author: `@gatsbyjs`,
    siteUrl: `https://gatsbystarterdefaultsource.gatsbyjs.io/`,
  },
  plugins: [
    `gatsby-plugin-typescript`,	// -> that has been added!
    `gatsby-plugin-react-helmet`,
    `gatsby-plugin-image`,
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `contents`,
        path: `${__dirname}/contents`,
    },
    `gatsby-transformer-sharp`,
    `gatsby-plugin-sharp`,
    {
      options: {
        name: `gatsby-starter-default`,
        short_name: `starter`,
        start_url: `/`,
        background_color: `#663399`,
        theme_color: `#663399`,
        display: `minimal-ui`,
        icon: `src/images/gatsby-icon.png`,
      },
    },
    `gatsby-plugin-gatsby-cloud`,
  ],
}

/* step 6_Modify gatsby-node.js */
const path = require('path');

// Setup Import Alias
exports.onCreateWebpackConfig = ({ getConfig, actions }) => {
  const output = getConfig().output || {};

  actions.setWebpackConfig({
    output,
    resolve: {
      alias: {
        components: path.resolve(__dirname, 'src/components'),
        utils: path.resolve(__dirname, 'src/utils'),
        hooks: path.resolve(__dirname, 'src/hooks'),
        //! if you wan to import file like
        // import Test from "@src/components/Test";
        '@src': path.resolve(__dirname, 'src'),
      },
    },
  });
};

Tailwindcss Install ( optional )

/* step 7_Install both tailwind and postcss and it makes tailwind.config.js & postcss.config.js automatically */
npm install -D tailwindcss postcss autoprefixer gatsby-plugin-postcss

npx tailwindcss init -p

/* step 8_Apply postcss on gatsby-config */
module.exports = {
  plugins: [
    'gatsby-plugin-postcss',
    // ...
  ],
}

/* step 9_Apply routes on tailwind.config.js */
module.exports = {
  content: [
    "./src/**/*.{js,jsx,ts,tsx}",
  ],

/* step 10_Create global.css and put below code in */
route : './src/styles/global.css'

@tailwind base;
@tailwind components;
@tailwind utilities;

/* step 11_Apply global css which has put tailwind codes in on gatsby-browser.js */
import './src/styles/global.css'
And now you can open your project typing only "gatsby develop" πŸ™ŒπŸΌ

Directory

contents

λΈ”λ‘œκ·Έ 포슀트 κ΄€λ ¨ νŒŒμΌλ“€μ„ μ €μž₯ν•˜κΈ° μœ„ν•œ 디렉토리.

src

- components
- pages

νŽ˜μ΄μ§€μ˜ 역할을 ν•˜λŠ” μ»΄ν¬λ„ŒνŠΈλ₯Ό μ €μž₯ν•˜κΈ° μœ„ν•œ 디렉토리. 기본적으둜 λΈŒλΌμš°μ €μ—μ„œ pages 디렉토리에 μžˆλŠ” 파일의 이름을 톡해 νŽ˜μ΄μ§€μ— μ ‘κ·Όν•  수 있기 λ•Œλ¬Έμ— νŽ˜μ΄μ§€μ˜ 역할이 μ•„λ‹Œ μ»΄ν¬λ„ŒνŠΈλ“€μ€ ν•΄λ‹Ή 디렉토리에 μ €μž₯ν•˜μ§€ μ•ŠλŠ”λ‹€. λ˜ν•œ, νŽ˜μ΄μ§€μ˜ ν…œν”Œλ¦Ώ νŒŒμΌμ—μ„œλ§Œ Query μ •μ˜κ°€ κ°€λŠ₯ν•˜λ‹€. 일반적인 μ»΄ν¬λ„ŒνŠΈμ—μ„œλŠ” λ³€μˆ˜λ‘œμ„œ μ •μ˜κ°€ λΆˆκ°€λŠ₯ν•˜κ³ , StaticQueryλΌλŠ” κΈ°λŠ₯을 톡해 μ •μ˜κ°€λŠ₯.

- hooks

Custom Hooks을 μ €μž₯ν•˜κΈ° μœ„ν•œ 디렉토리.

- templates

κ²Œμ‹œκΈ€ νŽ˜μ΄μ§€μ™€ 같이 νŽ˜μ΄μ§€μ˜ 역할을 ν•˜λ©΄μ„œ 같은 ν˜•μ‹μ˜ μ—¬λŸ¬ μ½˜ν…μΈ λ₯Ό λ³΄μ—¬μ£ΌλŠ” μ»΄ν¬λ„ŒνŠΈλ₯Ό μ €μž₯ν•˜κΈ° μœ„ν•œ 디렉토리.

Gatsbyμ—μ„œ μ œκ³΅ν•˜λŠ” APIλ₯Ό 톡해 이 디렉토리에 μ €μž₯된 ν…œν”Œλ¦Ώ μ»΄ν¬λ„ŒνŠΈλ‘œ μ—¬λŸ¬ νŽ˜μ΄μ§€λ₯Ό λ§Œλ“ λ‹€.

pages λ””λ ‰ν† λ¦¬μ™€λŠ” λ‹€λ₯΄κ²Œ 파일λͺ…μœΌλ‘œ νŽ˜μ΄μ§€μ— 접근이 λΆˆκ°€ν•˜λ‹€.

sookdev's People

Contributors

22sook00 avatar bellllla avatar

Watchers

 avatar

sookdev's Issues

16Jun22/movingDeploy/

ν”„λ‘ νŠΈμ—”λ“œ 벨라의 κ°œλ°œλΈ”λ‘œκ·Έ

μ£Όλ‹ˆμ–΄ ν”„λ‘ νŠΈμ—”λ“œ, 벨라의 κ³ κ΅°λΆ„νˆ¬ 개발 λΈ”λ‘œκ·Έ μž…λ‹ˆλ‹€.

https://22sook00/16Jun22/movingDeploy/

27Jun22/cleanCode/

ν΄λ¦°μ½”λ“œ

μ›Ήκ³Ό λ„€μ΄ν‹°λΈŒ μ•±μ˜ κΈ°λŠ₯ λͺ¨λ‘μ˜ 이점을 갖도둝 수 λ§Žμ€ νŠΉμ • 기술과 ν‘œμ€€ νŒ¨ν„΄μ„ μ‚¬μš©ν•΄ 개발된 μ›Ή μ•±

https://22sook00/27Jun22/cleanCode/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.