Installation

This guide will show you how to quickly get started with CO2.js in a variety of ways.

Using NPM

You can install CO2.js as a dependency for your projects using NPM.

npm install @tgwf/co2

Using Skypack

You can import the CO2.js library into projects using Skypack.

import tgwf from 'https://cdn.skypack.dev/@tgwf/co2';

Build it yourself

You can also build the CO2.js library from the source code. To do this:

  1. Go to the CO2.js repository on GitHub.

  2. Clone or fork the repository.

  3. Navigate to the folder on your machine and run npm run build in your terminal.

  4. Once the build has finished running, you will find a /dist folder has been created. Inside you can find:

    • dist/cjs - A CommonJS compatible build.
    • dist/esm - An ES Modules compatible build.
    • dist/iife - An Immediately Invoked Function Expression (IIFE) version of the library.