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 🙏

© 2024 – Pkg Stats / Ryan Hefner

corgi-widget

v1.1.0

Published

Corgi Widget is a JavaScript library for embedding a customizable widget on your website. This README provides instructions for clients on how to integrate the Corgi Widget using a CDN or as an npm package.

Downloads

5

Readme

Corgi Widget

Corgi Widget is a JavaScript library for embedding a customizable widget on your website. This README provides instructions for clients on how to integrate the Corgi Widget using a CDN or as an npm package.

Check out the Corgi Partner Documentation for up-to-date documentation and examples.

Table of Contents

Using CDN

To use the Corgi Widget via CDN, include the following script tag in your HTML file:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Your Website</title>
    
    <!--- Add Script Tag -->
    <script src="https://cdn.jsdelivr.net/npm/corgi-widget"></script>
</head>
<body>
    <!--- Add Corgi Widget -->
    <div id="corgi-widget" corgi-partner="partner-example" corgi-style="popup"></div>
</body>
</html>

Using npm Package

To use the Corgi Widget as an npm package in your application, follow these steps:

Installation

Install the Corgi Widget package via npm:

npm install corgi-widget

General Example for Projects

The Corgi Widget can be used in various frontend frameworks and libraries. The general approach involves importing the widget and initializing it in the appropriate lifecycle hook of the framework you are using.

Example Using Plain JavaScript:

  1. Install the Package:

    npm install corgi-widget
    
  2. Create a JavaScript File:

    import CorgiWidget from 'corgi-widget';
    
    document.addEventListener('DOMContentLoaded', () => {
        CorgiWidget.initializeWidget();
    });
  3. Include widget in your HTML:

    <div id="corgi-widget" corgi-partner="1" corgi-style="popup"></div>

Example Using React

  1. Create a React Component:

    Create a React component that initializes the widget. For example, create a file named CorgiWidgetComponent.jsx:

    import React, { useEffect } from 'react';
    import { initializeWidget } from 'corgi-widget';
       
    const CorgiWidgetComponent = () => {
        useEffect(() => {
            initializeWidget();
        }, []);
       
        return (
            <div id="corgi-widget" corgi-partner="1" corgi-style="popup"></div>
        );
    };
       
    export default CorgiWidgetComponent;
  2. Include the Component in Your Application:

    Use the CorgiWidgetComponent in your main application component. For example, update App.jsx:

    import React from 'react';
    import CorgiWidgetComponent from './CorgiWidgetComponent';
       
    const App = () => {
        return (
            <div>
                <h1>Corgi Widget Test</h1>
                <CorgiWidgetComponent />
            </div>
        );
    };
       
    export default App;