Learn GatsbyJS by creating a tourism site -6

Welcome to part-6 of the series. You can find part-5 here.

As told in the earlier post, this series is based on the learning from this awesome udemy course by John Smilga

As told in the earlier post, we need to install some plugins for using one of the main feature of Gatsby, which is image optimization in sites.

We need to install gatsby-source-filesystem first. This plugin is for using data into your Gatsby application, from local filesystem. In our case it will be images. The docs for the same can be found here.

As per the docs we need to npm install the plugin in our project directory.

So, head over to project directory and stop any gatsby develop, if it is running.

Image for post
Image for post
npm install

Rest of the chapter is exclusive content and will be in my upcoming book Gatsby Cookbook.

Image for post
Image for post

When you see the output on your browser, you can see the About component displaying the same image. But what you see is an optimized image, which loads very fast on all screen with even slow internet speeds.

Image for post
Image for post
New Image

This completes part-6 of the series. You can find the code for the same in this link.

You can find part-7 here.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store