Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have permission to ask a question, You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please type your username.

Please type your E-Mail.

Please choose an appropriate title for the post.

Please choose the appropriate section so your post can be easily searched.

Please choose suitable Keywords Ex: post, video.

Browse

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Navigation

  • Home
  • About Us
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • About Us
  • Contact Us
Home/ Questions/Q 1147

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Latest Questions

Author
  • 62k
Author
Asked: November 25, 20242024-11-25T05:26:07+00:00 2024-11-25T05:26:07+00:00

Getting started with gatsby js

  • 62k

Intro

Gatby js is on of the most fastest static site generator open source web framework made by combining React Graphql and web pack and today we gonna learn how to create a gatsby site and deploying it to gatsby cloud

Prerequisites

  • Although this article is beginner friendly but it’s better for the readers to have basic knowledge of Javascript & JSON(JavaScript object notation), Html , css, React styling components to understand the topics that will be explained

  • Latest version of Nodejs and npm

  • Basic knowledge if git and Github

  • gatsby cli

  • gatsby cloud account

  • A Code editor(I am using vs code )

    the most important

  • The patience to read the full article

    setup

  • Install node js link

  • Install git and git bash from link
    = Now open the terminal and use
    npm install -g gatsby-cli
    This will install gatsby cli globally on your local machine

Now open the terminal follow the steps
Type gatsby new
Enter an site name “Gatsby Tutorial” (By default it will show My Gatsby Site)
create
We will now use any modification in this tutorial
clone
done
Our gatsby project is successfully created now use
cd <project name > then hit gatsby develop to see our changes locally at localhost:8000
develop
now let's navigate to our project folder in our code editor
navigate

this is how our gatsby file structure looks like

localhost
this is how our project looks locally

Now we are done with our setup , so let's make cahnges to our project . In the begining lets's delete all the markup and let's start from scratch
reder
Here the Indexpage will render all the hml markup written within the tag (you can also use <div> here instead of <main>)
Now let's add some html and see what happens to our page

import * as React from 'react'; const IndexPage = () => {   return (     <main>       <title>My Gatsby tutorial</title>       <h1>Hi, there I am gatsby app</h1>       <h4>         Lorem ipsum dolor sit amet consectetur adipisicing elit. Et ducimus         labore magni facere est autem eum provident expedita laudantium. Magni         vitae quia impedit delectus quo iste aliquam rerum, ipsa natus. Lorem         ipsum dolor sit amet, consectetur adipisicing elit. Consequatur ex         accusantium deleniti et sint perspiciatis similique deserunt, molestias         nam, quas cumque id! Esse necessitatibus animi eos quibusdam sunt ad         dignissimos! Lorem ipsum, dolor sit amet consectetur adipisicing elit.         Soluta itaque delectus in, inventore, voluptatem at ab beatae pariatur         magni eum omnis! Voluptatum quo dicta nostrum. Sit numquam         exercitationem asperiores quibusdam.         <br />         Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloremque,         necessitatibus? Sunt dolorem corporis provident vero molestiae. Natus         inventore velit assumenda quis accusantium beatae, quaerat molestias         sapiente quos? Atque, quia saepe.         <hr />         Lorem ipsum dolor sit amet consectetur adipisicing elit. Minima         assumenda veniam distinctio delectus molestiae, itaque nemo cupiditate         sint sequi ad, dolorum asperiores magnam accusamus. Molestiae dicta         alias recusandae nostrum numquam.       </h4>     </main>   ); };  export default IndexPage;  
Enter fullscreen mode Exit fullscreen mode

demo1

Now lets add some styles
for styling purpose we will define style objects lets see

import * as React from 'react'; let sytles = {   mainStyle: {     color: 'blue',     padding:'30px',     font:"Arial, Helvetica, sans-serif"    }, }; const IndexPage = () => {   return (     <main style={sytles.mainStyle}>       <title>My Gatsby tutorial</title>       <h1>Hi, there I am gatsby app</h1>       <h4>         Lorem ipsum dolor sit amet consectetur adipisicing elit. Et ducimus         labore magni facere est autem eum provident expedita laudantium. Magni         vitae quia impedit delectus quo iste aliquam rerum, ipsa natus. Lorem         ipsum dolor sit amet, consectetur adipisicing elit. Consequatur ex         accusantium deleniti et sint perspiciatis similique deserunt, molestias         nam, quas cumque id! Esse necessitatibus animi eos quibusdam sunt ad         dignissimos! Lorem ipsum, dolor sit amet consectetur adipisicing elit.         Soluta itaque delectus in, inventore, voluptatem at ab beatae pariatur         magni eum omnis! Voluptatum quo dicta nostrum. Sit numquam         exercitationem asperiores quibusdam.         <br />         Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloremque,         necessitatibus? Sunt dolorem corporis provident vero molestiae. Natus         inventore velit assumenda quis accusantium beatae, quaerat molestias         sapiente quos? Atque, quia saepe.         <hr />         Lorem ipsum dolor sit amet consectetur adipisicing elit. Minima         assumenda veniam distinctio delectus molestiae, itaque nemo cupiditate         sint sequi ad, dolorum asperiores magnam accusamus. Molestiae dicta         alias recusandae nostrum numquam.       </h4>     </main>   ); };  export default IndexPage;  
Enter fullscreen mode Exit fullscreen mode

Here we have defined a variable named styles and within it we have defied a property named main style and we are passing it as an expression to in the style attribute.

now let's add some images to our application

import * as React from 'react'; let sytles = {   mainStyle: {     color: 'blue',     padding:'30px',     font:"Arial, Helvetica, sans-serif"    },    imagsStyle:{      width:"400px",      radius:"10px"    } }; const IndexPage = () => {   return (     <main style={sytles.mainStyle}>       <title>My Gatsby tutorial</title>       <h1>Hi, there I am gatsby app</h1>       <h4>         Lorem ipsum dolor sit amet consectetur adipisicing elit. Et ducimus         labore magni facere est autem eum provident expedita laudantium. Magni         vitae quia impedit delectus quo iste aliquam rerum, ipsa natus. Lorem         ipsum dolor sit amet, consectetur adipisicing elit. Consequatur ex         accusantium deleniti et sint perspiciatis similique deserunt, molestias         nam, quas cumque id! Esse necessitatibus animi eos quibusdam sunt ad         dignissimos! Lorem ipsum, dolor sit amet consectetur adipisicing elit.         Soluta itaque delectus in, inventore, voluptatem at ab beatae pariatur         magni eum omnis! Voluptatum quo dicta nostrum. Sit numquam         exercitationem asperiores quibusdam.         <br />         Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloremque,         necessitatibus? Sunt dolorem corporis provident vero molestiae. Natus         inventore velit assumenda quis accusantium beatae, quaerat molestias         sapiente quos? Atque, quia saepe.         <hr />         Lorem ipsum dolor sit amet consectetur adipisicing elit. Minima         assumenda veniam distinctio delectus molestiae, itaque nemo cupiditate         sint sequi ad, dolorum asperiores magnam accusamus. Molestiae dicta         alias recusandae nostrum numquam.       </h4>       <img src={'https://picsum.photos/200/300'} alt="an image" style={sytles.imagsStyle} />     </main>   ); };  export default IndexPage;  
Enter fullscreen mode Exit fullscreen mode

Now we are ready with our gatsby app. let's deploy it to gatsby cloud

Deployment

create a git repo and push your code to gihub
git push
now we have pushed our code to github
open your gatsby cloud dashboard and click on add a site
gatsby cloud
now choose your repo and click on import
choose

now click on next as we don't have any configurations
next

and then click on build site

build
see how fast it is , deployed in just 0.26 seconds
you can checkout my site here
my site
and github repo

Conclusion

so this was all about creating a basic gatsby js application and deploying to gatsby js cloud. If you love this article share it with your peers and don't hesitate to hit a ❤️ .

Connect



gatsbyjavascripttutorialwebdev
  • 0 0 Answers
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Ask A Question

Stats

  • Questions 4k
  • Answers 0
  • Best Answers 0
  • Users 2k
  • Popular
  • Answers
  • Author

    Insights into Forms in Flask

    • 0 Answers
  • Author

    Kick Start Your Next Project With Holo Theme

    • 0 Answers
  • Author

    Refactoring for Efficiency: Tackling Performance Issues in Data-Heavy Pages

    • 0 Answers

Top Members

Samantha Carter

Samantha Carter

  • 0 Questions
  • 20 Points
Begginer
Ella Lewis

Ella Lewis

  • 0 Questions
  • 20 Points
Begginer
Isaac Anderson

Isaac Anderson

  • 0 Questions
  • 20 Points
Begginer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help

Footer

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore, ask, and connect. Join our vibrant Q&A community today!

About Us

  • About Us
  • Contact Us
  • All Users

Legal Stuff

  • Terms of Use
  • Privacy Policy
  • Cookie Policy

Help

  • Knowledge Base
  • Support

Follow

© 2022 Querify Question. All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.