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

cooksent

v0.0.1

Published

Straight simple cookie consent popin using local storage

Readme

CookSent

Straight simple cookie consent popin using local storage

Developped with Babel, webpack, Jest and :heart:

Motivation

Simple and lightweight reusable cookie consent module for web dev

Usage

Here is the simplest way to init and use the cookie consent. You can find more examples in the examples/ directory of this repo.

import Cooksent from 'cooksent';
const cooksent = Cooksent.factory();

Table of Contents

Installation

npm install cooksent
yarn add cooksent

Consent Options

Default values:

{
    selector: 'js-cooksent',
    btnSelector: 'js-cooksent__btn',
    title: 'Cookie Consent',
    description: 'By continuing your navigation without changing your cookie settings, you accept the use of cookies to analyse and measure audience, attendance, navigation and redirection from external websites.',
    btnLabel: 'ok',
    onConsent: () => {},
    storageKey: 'COOKSENT',
}

selector

Main popin section class selector

btnSelector

Consent button class selector

title

Popin title

description

Popin description

btnLabel

Popin button label

storageKey

Key used in local storage to memorise the user consent

onConsent

onConsent expects a function that will be executed when the user clicks on the consent button.

Contribute

File structure

cooksent/
 ├──src/                             * our source files that will be compiled to javascript
 |   ├──app/                         * Lib sources
 │   │
 |   └──examples/                    * examples sources
 │       ├──index.pug                * our index.html
 │       │
 │       ├──html/                    * where you keep your pug templates
 │       │   └──layout.pug           * the main pug layout
 │       │
 │       └──app/                     * JavaScript/ES2015 files
 │
 ├──test/                            * Jest test definitions
 │
 ├──webpack/                         * Webpack configuration files
 │   ├──webpack.config.base.js       * Base config
 │   ├──webpack.config.js            * Development overrides
 │   └──webpack.config.prod.js       * Production overrides
 │
 └──package.json                     * package.json

Getting Started

Dependencies

You need to install the following on you system

  • node and npm
  • Ensure you running Node version >= 8.0.0

Installing

Running the app

After all dependencies are installed, just run make start to start a local server using webpack-dev-server which will watch your files and build them. webpack-dev-server will display the address and port of your server (by default, http://0.0.0.0:3000).

Build commands

Server

# build files then launch the server and watch files
make start

Build files

# build files in ./build/ (Webpack, Sass, Pug) and validate them
make build
# "compile" files in ./dist/
# minify and concatenate assets
make release

Validate files

# runs the validations eslint and jest tests
make test

License

MIT

Author: Frank Gairal