Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vite-code-inspector-plugin

Package Overview
Dependencies
Maintainers
1
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-code-inspector-plugin

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18K
increased by54.61%
Maintainers
1
Weekly downloads
 
Created
Source

vite-code-inspector-plugin

English Doc | 中文文档 | webpack-code-inspector-plugin

NPM version GITHUB star MIT-license


📜Introduction

Click the element on the page, it will automatically open the code editor and position the cursor to the source code of the element.

code-inspector

🚀Install

npm i vite-code-inspector-plugin -D
# or
yarn add vite-code-inspector-plugin -D
# or
pnpm add vite-code-inspector-plugin -D

📦Usage

1. configure vite.config.js

  • Add the following configuration in vite.config.js:

    // vite.config.js
    import { defineConfig } from 'vite';
    import { ViteCodeInspectorPlugin } from 'vite-code-inspector-plugin';
    
    // https://vitejs.dev/config/
    export default defineConfig({
      plugins: [ViteCodeInspectorPlugin()],
    });
    

2. Configure Vscode Command

If your editor is Vscode, you need to do the following:

  • Execute command + shift + p(mac) or ctrl + shift + p(windows) command in vscode, search and click shell Command: Install 'code' command in Path:

  • If the following popup window appears, your configuration is successful:

3. Use Code Inspector

You can perform code inspector mode by turning on the switch or simultaneously pressing and holding hotKeys(default mac is 【Option + Shift】 and windows is 【Alt + Shift】). In this mode, click the element on the page, it will automatically open the code editor and position the cursor to the source code of the element.

🎨Options

ParameterDescriptionTypeOptionValueDefault
hideSwitchWhether hide the button of this functionbooleantrue/falsefalse
hotKeysCombination keys for triggering this function.When the value is false or [], the function can't be triggered by keys.string[] | falseArray<'ctrlKey'|'altKey'|'metaKey'|'shiftKey'> | false['altKey', 'shiftKey']
autoToggleAfter opening the function switch, whether automatically close the switch when triggering the jump editor function.booleantrue/falsetrue
// vite.config.js
import { defineConfig } from 'vite';
import { ViteCodeInspectorPlugin } from 'vite-code-inspector-plugin';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    ViteCodeInspectorPlugin({
      hideSwitch: false,
      hotKeys: ['altKey', 'shiftKey'],
      autoToggle: true,
    }),
  ],
});

❓FAQ

  • Editor doesn't open automatically
    If your editor doesn't open automatically when you click on a page element, it could be because of system permissions or other issues that prevent the plugin from reading the programs currently running on your computer. Please add a file named .env.local to your project root directory, add the following content:
    # editor
    CODE_EDITOR=code
    

FAQs

Package last updated on 23 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc