Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/novagaia/gatsby-plugin-ecoindexbadge
A Gatsby plugin to display the ecologic footstep of your page
https://github.com/novagaia/gatsby-plugin-ecoindexbadge
cnumr gatsby gatsby-plugin greenit
Last synced: about 1 month ago
JSON representation
A Gatsby plugin to display the ecologic footstep of your page
- Host: GitHub
- URL: https://github.com/novagaia/gatsby-plugin-ecoindexbadge
- Owner: NovaGaia
- License: isc
- Created: 2021-06-10T07:28:16.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-04-18T08:51:02.000Z (over 2 years ago)
- Last Synced: 2024-11-15T04:21:11.091Z (about 1 month ago)
- Topics: cnumr, gatsby, gatsby-plugin, greenit
- Language: JavaScript
- Homepage: https://novagaia.fr
- Size: 223 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Changelog: HISTORY.md
- License: LICENSE
Awesome Lists containing this project
README
# gatsby-plugin-ecoindexbadge
https://github.com/NovaGaia/gatsby-plugin-ecoindexbadge
## Description
This is a GatsbyJS plugin that displays a badge on the page giving information about the ecological impact of the page consulted.
### Learning Resources
It is simply a plugin that will load a javascript created and hosted by **Simon Vandaele**.
The calculation functions come from GreenIT-Analysis `GNU Affero General Public License AGPL v3 / Copyright (C) 2019 [email protected]`
More informations https://github.com/simonvdfr/ecoindex-light-js
### Changelog
**More informations in [`HISTORY.md`](https://github.com/NovaGaia/gatsby-plugin-ecoindexbadge/blob/main/HISTORY.md)**
## How to install
Install via npm or yarn
`npm install gatsby-plugin-ecoindexbadge --save`
`yarn add gatsby-plugin-ecoindexbadge`
Just add the plugin to the plugins array in your `gatsby-config.js`
```javascript
plugins: {
[`gatsby-plugin-ecoindexbadge`],
...
}
```or
```javascript
plugins: {
{
resolve: 'gatsby-plugin-ecoindexbadge',
options: {
mode: 'manual', // 'external' / 'manual' default:'external'
},
},
...
},
```## Available options
`mode` tells the plugin to load the GreenIT community JavaScript library instead of using the internal `EcoindexBadge` component.
## Examples of usage
### En utilisant la library GreenIT
Simply in your configuration file `gatsby-config.js` load the plugin like this:
```javascript
plugins: {
[`gatsby-plugin-ecoindexbadge`],
...
}
```### Using the internal component ``
1. Configure the plugin like this (otherwise you will have several badges!):
```javascript
plugins: {
{
resolve: 'gatsby-plugin-ecoindexbadge',
options: {
mode: 'manual', // 'external' / 'manual' default:'external'
},
},
...
},
```**Mode :**
- `external` calling and using the GreenIT library (default mode)
- `manual` use of internal calculation [loading of GreenIT library disabled(*)] and you have to add the component yourself, see point 2.(\*) Good practice: The `manual` mode should be used only if the use of the external library causes bugs or conflicts with other libraries.
2. Import the component:
```javascript
import { EcoindexBadge } from 'gatsby-plugin-ecoindexbadge';
```3. In your code insert the component with the language to be displayed:
```javascript
```