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

view-launcher

v1.1.7

Published

<div align="center"> <img src="https://user-images.githubusercontent.com/13927101/113034395-00a3f380-91cd-11eb-8c73-783c54ce2c2b.png" width="160" height="160"> <h1>ViewLaucher</h1>A tool for inspecting and opening view files in your code editor <s

Downloads

784

Readme

Table of Contents

Motivation

When you're working on a rather large project, you may have lots of views, whenever you want to make a change to a specific view, you have to figure out where it was located first.

Even if you just want to change a single letter of the view, you have to first find out the view, to me, this is super tedious and unproductive‼ Especially when collaborating with other people, chances are that you'll have a hard time finding the view file…

This package provides you a simple way to locate the view file. Just click the HTML element from the browser, it'll jump to the view file in your code editor automagically.

Kind of like a "sourcemap of markup", helps you inspect your view at light speed ⚡⚡️️

Demo

A full demo(for Vue.js using Vite) can be found at the playground directory. If you'd like to have it a try, just cd into playground run yarn dev.

The default shortcuts for inspecting elements are:

| Key | Action | |-------|----------------------------------------------------------| | A A | Toggle inspect mode | | C C | Toggle inspect mode, but only inspect components | | D | Open with your editor(the default setting is VSCode) | | E | Inspect the parent element of current inspecting element |

🔰 Usage

Notice: This is the usage guide for client-side lib of ViewLauncher.
For framework specific installation guide see:

You can ignore this if you are using one of the above packages, you are going to have the same options in there.

import { viewLauncher } from 'view-launcher'

const options = {
  theme: 'light',
  editor: 'vscode',
  shortcuts: {
    open: 'd',
    inspect: 'a a',
    inspectComponent: 'c c',
    inspectParent: 'e',
  },
}

viewLauncher(options)

⚙️ Options

The following options are available.

type Options = {
  /**
   * The color theme to be used.
   */
  theme: 'dark' | 'light'

  /**
   * The editor you'd like to use.
   */
  editor: Editor

  /**
   * The shortcuts settings.
   * see the link below for the possible values.
   * @link https://github.com/ccampbell/mousetrap
   */
  shortcuts: {
    /**
     * Open the editor.
     */
    open: string

    /**
     * Toggle inspect mode.
     */
    inspect: string

    /**
     * Toggle inspect mode, but only inspect components.
     */
    inspectComponent: string

    /**
     * Inspect the parent element of current inspecting element.
     */
    inspectParent: string
  }
}

✏️ Supported Editors

  • sublime
  • textmate
  • emacs
  • macvim
  • phpstorm
  • webstorm
  • idea
  • vscode
  • vscode-insiders
  • atom

💡 How does it work?

Elements where have the data-tag-info attribute will be marked as "inspectable elements".

An example of the value of data-tag-info attribute may look like this:

{
  "view": "/path/to/the/view/file",
  "line": 100,
  "column": 23,
  "component": "Modal"
}

ViewLauncher(client-side lib) is going to use the information taken from data-tag-info to open the view files.
The data-tag-info attribute should be injected automatically at the compile-time of view file.
For instance, in the case of Vue-SFC, data-tag-info attributes are injected at the load/transform stage of your bundler.

Contribution

PR is always welcomed. Let me know if you are considering implementing any new support for other template languages 🖐🏼.