Code Monkey home page Code Monkey logo

gatsby-plugin-ecoindexbadge's Introduction

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

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

plugins: {
    [`gatsby-plugin-ecoindexbadge`],
    ...
}

or

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:

plugins: {
    [`gatsby-plugin-ecoindexbadge`],
    ...
}

Using the internal component <EcoindexBadge lang="EN|FR" />

  1. Configure the plugin like this (otherwise you will have several badges!):
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.

  1. Import the component:
import { EcoindexBadge } from 'gatsby-plugin-ecoindexbadge';
  1. In your code insert the component with the language to be displayed:
<EcoindexBadge lang='EN|FR' />

gatsby-plugin-ecoindexbadge's People

Contributors

hrenaud avatar

Stargazers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.