npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@tngtech/if-webpage-plugins

v1.0.7

Published

Impact Framework - Plugins for estimating CO2e Impact of Webpages

Downloads

45

Readme

Impact Framework - Plugins for Estimating Carbon Emissions of Webpages

Introduction

With the plugins contained in this repo you can estimate the carbon emissions of a webpage. The plugins are designed to be used with the Impact Framework. You can assemble a pipeline with them that follows the same methodology as websitecarbon.com or ecograder.com. See below for an example.

As the two aforementioned carbon estimation websites, the pipeline is using the sustainable web design model (swd) for carbon estimation. It is provided by the co2js plugin [1]. The swd model has a broad scope and includes all essential segments of the network into its estimation

  • consumer device use
  • network use
  • data centre use
  • hardware production

It makes the complexity of estimating the emissions of all this segments accessible by focusing on the number of transferred bytes on webpage load only. This number of bytes is multiplied by energy consumption per transferred byte. A metric that is estimated such that it includes the energy usage of entire system / internet. The estimated engery use is then multiplied by carbon intensity factor to get the carbon emissions attributed to the webpage load.

Of course, this approach sacrifices some accuracy for simplicity. For example the distance that the bytes travel through the network has no effect on the estimate but on the real emissions. Also, the amount of work that the data center has to do to process the requests, is not taken into account, just the size of the response that is finally sent. If you want to read up on the details of the swd model and the choices behind it, you can do so here.

Compared to the mentioned carbon estimation websites, this pipeline has the advantage that you can choose all parameters that go into the estimation explicitly and make them transparent in your manifest file. The WebpageImpact plugin also makes an attempt to approximate the amount of data that is reloaded on revisit, thus taking into account the effectiveness of the caching layer explicitly - but there are some caveats. See the plugin README for more details.

[1] co2js plugin: For now this is a slightly modified version of the original plugin in if-unofficial-plugins. But necessary changes are hopefully merged soon with this PR.

Plugins

  • Webpage Impact
  • Green Hosting Check

The Webpage Impact plugin can measure the page weight of a webpage. It can also estimate the dataReloadRatio needed for the Sustainable Webdesign Model provided by the co2js plugin.

The Green Hosting Check plugin can check if a website is hosted green by querying the database of the Green Web Foundation.

For further info on the plugins, see their README files.

Installation

For usage with the Impact Framework cli install globally with

pnpm install -g @tngtech/if-webpage-plugins

Puppeteer also requires access to a Chrome installation. If none is available, install it with pnpm exec puppeteer browsers install chrome.

Example Usage (manifest file)

Also see example-manifests directory.

Note: This manifest was tested with v0.7.1 of the Impact Framework (IF). Since IF's interface is still subject to change, it cannot be guaranteed that this manifest and the plugins will work with future versions of IF.

name: webpage-impact-demo
description: example manifest for estimating carbon emissions of a webpage
tags:
initialize:
  outputs:
    - yaml
  plugins:
    'green-hosting':
      method: GreenHosting
      path: '@tngtech/if-webpage-plugins'
    'webpage-impact':
      method: WebpageImpact
      path: '@tngtech/if-webpage-plugins'
      config:
        scrollToBottom: false
        url: https://www.tngtech.com/
    'co2js':
      method: Co2js
      path: '@tngtech/if-webpage-plugins'
      config:
        type: swd
        version: 4
tree:
  children:
    child:
      pipeline:
        observe:
          - webpage-impact
          - green-hosting
        compute:
          - co2js
      inputs:
        - options: # for co2js plugin: swd model options
            firstVisitPercentage: 0.9
            returnVisitPercentage: 0.1

License

if-webpage-plugins is published under the Apache License 2.0. For more information concerning the license, see Apache License 2.0.