This guide will show you how to quickly get started with CO2.js in a variety of ways.
You can install CO2.js as a dependency for your projects using NPM.
npm install @tgwf/co2
You can import the CO2.js library into projects using Skypack.
import tgwf from 'https://cdn.skypack.dev/@tgwf/co2';
You can also build the CO2.js library from the source code. To do this:
Go to the CO2.js repository on GitHub.
Clone or fork the repository.
Navigate to the folder on your machine and run npm run build
in your terminal.
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.