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

@streeva/vue-cookie-bar-plugin

v1.0.7

Published

[![Unit tests](https://github.com/streeva/vue-cookie-bar-plugin/actions/workflows/TestPlugin.yml/badge.svg)](https://github.com/streeva/vue-cookie-bar-plugin/actions/workflows/TestPlugin.yml) ![Vue 2.x](https://img.shields.io/badge/vue-2.x-green.svg "Vue

Downloads

11

Readme

Vue-Cookie-Bar-Plugin

Unit tests Vue 2.x

Usage

Install

npm i -S @streeva/vue-cookie-bar-plugin

Quickstart

Add to your app main js or ts file:

import CookieBar from '@streeva/vue-cookie-bar-plugin'

Vue.use(CookieBar, {
  havenOptions: {
    domains: ['.example.com'],
    services: [
      {
        name: 'google-tag-manager',
        purposes: ['analytics'],
        type: 'google-tag-manager',
        inject: true,
        options: {
          id: 'GTM-T4P1234',
        },
      },
    ],
  },
})

Then place the following in a single main Vue file such as App.vue:

<CookieBar>
  <template v-slot:title>🍪 Can we use optional cookies?</template>
  <template v-slot:text>
    These cookies help us keep our website safe and give you a better
    experience. We won’t turn them on unless you accept. Want to know more
    or adjust your preferences? Here's our
    <a href="https://www.example.co.uk/legal/cookies/">cookie policy</a>
  </template>
</CookieBar>

Haven

The global $haven object

The plugin uses and exposes Haven as $haven. A list of options to inject into havenOptions when initialising the plugin can be found here.

Updating cookie preferences

Note: The plugin was only intended to show the cookie notification (and capture the preferences), but it can also display cookie preferences that allow updates to cookie consent (such as on a cookies policy page) where consent can be updated.

You can add this functionality easily by adding <div id="cookie-preferences"></div> anywhere on a page or in a component. See here for a list of available options.


Development

This is the dev environment for the plugin and includes a single page with the cookie bar and cookie preferences.

The plugin is packaged up whenever there is a release published. It is then published to NPM under streeva org.

Install modules

npm install

Compiles and hot-reloads for development

npm run serve

Compiles and minifies for production

npm run build

Compiles and minifies a library for production

This command is run when a push to master occurs, note that if the push hasn't changed the version property in package.json then nothing will be pushed the GitHub package repository.

npm run build-library

Run your unit tests

npm run test:unit

Lints and fixes files

npm run lint

Testing the plugin within another project

If you want to test or edit this project from within another project without uploading and downloading to NPM each time then npm link provides a useful way to be able to symlink straight to this project. E.g.

cd ~/src/ui                        # go into the dir of your main project
npm link ../vue-cookie-bar-plugin  # link the dir of your dependency

The symlink can be seen or deleted by visiting /lib/node_modules. See the npm link docs for more info.

Example workflow for altering and testing the plugin in donor UI

Change to cookie plugin directory:

  • cd ~/src/vue-cookie-bar-plugin
  • Make your alterations
  • npm run build-library

Change to UI directory:

  • cd ~/src/ui
  • rm -rf node_modules
  • npm i
  • npm link ../vue-cookie-bar-plugin
  • npm run dev