内容简介: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
Jul 6 ·9min read
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.
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:
Once you create the query and run it, you will see the following result.
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:
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Scrum敏捷软件开发
Mike Cohn / 廖靖斌、吕梁岳、陈争云、阳陆育 / 清华大学出版社 / 2010-11 / 69.00元
《Scrum敏捷软件开发》是敏捷联盟及Scrum联盟创始人之一、敏捷估算及计划的鼻祖Mike Cohn三大经典著作中影响最为深厚的扛鼎之作,也是全球敏捷社区中获得广泛肯定的企业敏捷转型权威参考。作者花四年时间,把自己近十五年的敏捷实践经验,特别是近四年中针对各种敏捷转型企业的咨询和指导工作,并结合旁征博引的方式,从更高的思想层次对敏捷与Scrum多年来的经验和教训进行深入而前面的梳理和总结,最终集......一起来看看 《Scrum敏捷软件开发》 这本书的介绍吧!