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

vue-source

v1.1.1

Published

Global Vue mixin which identifies components in source code with HTML comments

Downloads

1,009

Readme

Vue Source

Overview

Vue Source is a global Vue mixin which identifies components in source code by adding HTML comments:

inspector

The plugin has various optional features:

  • render comments as class names, tags, or file paths
  • manual or automatic activation based on environment variable
  • attach JavaScript references to DOM comments
  • inspect in Vue Devtools v4

Installation and usage

Download via NPM:

npm install vue-source --save

Import and run from your main application file:

import VueSource from 'vue-source'

Vue.use(VueSource)

The default settings are:

  • render comments as class names
  • activate in development, but not in production
  • attach component and file references to rendered comments

Settings

You can pass settings to Vue.use() to change Vue Source's behaviour:

import Vue from 'vue'
import VueSource from 'vue-source'

Vue.use(VueSource, {
  type: 'file',
  active: true,
  debug: true
})

Type

Render comment as class name, file path, or source code tag:

type : ('class'|'file'|'tag')

Class names:

comment-class

File paths:

comment-file

Tags:

comment-component

Where files don't exist (i.e router links) the plugin will attempt to render classes or tags instead.

Active

Activate or disable at startup:

active : ('auto'|true|false|expression)

Pass:

  • 'auto' (the default) which checks process.env.NODE_ENV to run in anything except production
  • true to always enable
  • false to always disable
  • any other expression which evaluates to true/false to choose whether to enable

Debug

Attach references to the rendered comment:

debug : (true|false)

By default, the plugin attaches the following references to the DOM comment:

  • vm: the Vue instance
  • tag: the markup tag
  • file: the source file path
  • class: the source class name
  • inspect(): a function to inspect the component in Vue's DevTools (v4 feature)

To access these references in your browser's Vue Devtools:

  1. inspect the HTML comment in the Elements panel
  2. reference it in the Console via $0

debug

Set debug to false if you want to disable this functionality.