10 Top GatsbyJS Plugins For 2020

栏目: IT技术 · 发布时间: 4年前

内容简介:Gatsby is a React-based free and open-source framework that allows developers to build optimized web apps following the latest web standards. It’s a static site generator like Hugo and Jekyll. However, Gatsby does better in many aspects than Hugo and Jekyl

10 Top GatsbyJS Plugins for 2020

Recommended Gatsby plugins to use in 2020

10 Top GatsbyJS Plugins For 2020

Gatsby is a React-based free and open-source framework that allows developers to build optimized web apps following the latest web standards. It’s a static site generator like Hugo and Jekyll. However, Gatsby does better in many aspects than Hugo and Jekyll as you can see from this comparison .

You don’t need Gatsby to deliver optimized web apps. You can do it yourself. Be prepared, though, for long and endless testing and configurations. Gatsby's slogan, “fast in any way that matters” really nails it since it speed-up development and not just your app.

Gatsby is not limited to its own eco-system of plugins, starters, themes, etc. (as it is, React-based). Many React tools go hand-in-hand with Gatsby, and bring out the best of it.

For example, Gatsby developers often use Bit ( Github ) to share components between Gatsby projects and speed up development even further. Shared components can be anything from a “dumb” UI component, to a data-fetching component (using staticQuery ), and even full-on layouts.

10 Top GatsbyJS Plugins For 2020
Example: exploring React components shared on Bit.dev

Read more about ithere:

In this article, we will talk about 10 such great plugins that you should use in your next react application.

1. gatsby-source-filesystem

gatsby-source-filesystem is a plugin that can be used to source JSON data or any other formatted data into your application with supporting plugins. You can collect data from a URL or local file. This plugin creates File nodes whom can be transformed into various other data types such as JSON and MarkDown. You have to use transformer plugins like gatsby-transformer-json and gatsby-transformer-remark for that.

installing the plugin,

After installing the plugin, create the instance of this plugin in gatsby-config.js . This plugin will create nodes from different locations of your file system specified in the instance. For example, we’ll create an instance of pages and images folder with the following code.

Go to http://localhost:8000/___graphq and create the query as shown below:

10 Top GatsbyJS Plugins For 2020

Once you create the query and run it, you will see the following result.

10 Top GatsbyJS Plugins For 2020

Results of the created query in GraphQL

You need to know about the three helper functions that this plugin exports. createFilePath function is used to create URLs from file paths on the system. createRemoteFileNode function lets you download remote files and add them to the site’s GraphQL schema. Finally, createFlieNodeFromBuffer function caches the data that is not in the local system. It creates the buffer and caches its content to a disk to create the file node that points to it.

2. gatsby-image

gatsby-image is a plugin for speedy and optimized images for Gatsby sites. This React component works seamlessly with GraphQL queries. It combines native image processing techniques of Gatsby with advanced image processing techniques to load images with optimizations. Further, It also uses Gatsby-plugin-sharp to enhance its image transformations. Here are some features of the gatsby-image plugin.

1) Optimizes the image size based on the size and resolution of each device.

2) This plugin holds the image position while it’s loading to avoid jumping around.

3) The plugin displays a blur-up image until image loading is completed.

4) Loading of the image is done using lazy load considering the bandwidth and speeds.

5) It Maintains the consistency between pages.

To start with Gatsby-images, install,

Include gatsby-plugin-sharp , and gatsby-transformer-sharp in gatsby-config.js .

This is how gatsby-image is used in a component.

See an example here:


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

数据之美

数据之美

邱南森 (Nathan Yau) / 张伸 / 中国人民大学出版社 / 2014-2-1 / CNY 89.00

这是一本教我们如何制作完美可视化图表,挖掘大数据背后意义的书。作者认为,可视化是一种媒介,向我们揭示了数据背后的故事。他循序渐进、深入浅出地道出了数据可视化的步骤和思想。本书让我们知道了如何理解数据可视化,如何探索数据的模式和寻找数据间的关联,如何选择适合自己的数据和目的的可视化方式,有哪些我们可以利用的可视化工具以及这些工具各有怎样的利弊。 作者给我们提供了丰富的可视化信息以及查看、探索数......一起来看看 《数据之美》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码