Siphiwe  Harmse

Siphiwe Harmse

1627859400

Buttons Usage Guide With WPBakery WordPress Plugin

In today’s WordPress video tutorial we’ll explore the usage and customization of buttons in WordPress using the WPBakery WordPress plugin elements. We also will use the Ultimate-addons WordPress plugin advanced button element to see the difference and how to customize it.

#wpbakery #wordpress

What is GEEK

Buddha Community

Buttons Usage Guide With WPBakery WordPress Plugin

How To Customize WordPress Plugins? (4 Easy Ways To Do)

This is image title
WordPress needs no introduction. It has been in the world for quite a long time. And up till now, it has given a tough fight to leading web development technology. The main reason behind its remarkable success is, it is highly customizable and also SEO-friendly. Other benefits include open-source technology, security, user-friendliness, and the thousands of free plugins it offers.

Talking of WordPress plugins, are a piece of software that enables you to add more features to the website. They are easy to integrate into your website and don’t hamper the performance of the site. WordPress, as a leading technology, has to offer many out-of-the-box plugins.

However, not always the WordPress would be able to meet your all needs. Hence you have to customize the WordPress plugin to provide you the functionality you wished. WordPress Plugins are easy to install and customize. You don’t have to build the solution from scratch and that’s one of the reasons why small and medium-sized businesses love it. It doesn’t need a hefty investment or the hiring of an in-house development team. You can use the core functionality of the plugin and expand it as your like.

In this blog, we would be talking in-depth about plugins and how to customize WordPress plugins to improve the functionality of your web applications.

What Is The Working Of The WordPress Plugins?

Developing your own plugin requires you to have some knowledge of the way they work. It ensures the better functioning of the customized plugins and avoids any mistakes that can hamper the experience on your site.

1. Hooks

Plugins operate primarily using hooks. As a hook attaches you to something, the same way a feature or functionality is hooked to your website. The piece of code interacts with the other components present on the website. There are two types of hooks: a. Action and b. Filter.

A. Action

If you want something to happen at a particular time, you need to use a WordPress “action” hook. With actions, you can add, change and improve the functionality of your plugin. It allows you to attach a new action that can be triggered by your users on the website.

There are several predefined actions available on WordPress, custom WordPress plugin development also allows you to develop your own action. This way you can make your plugin function as your want. It also allows you to set values for which the hook function. The add_ action function will then connect that function to a specific action.

B. Filters

They are the type of hooks that are accepted to a single variable or a series of variables. It sends them back after they have modified it. It allows you to change the content displayed to the user.

You can add the filter on your website with the apply_filter function, then you can define the filter under the function. To add a filter hook on the website, you have to add the $tag (the filter name) and $value (the filtered value or variable), this allows the hook to work. Also, you can add extra function values under $var.

Once you have made your filter, you can execute it with the add_filter function. This will activate your filter and would work when a specific function is triggered. You can also manipulate the variable and return it.

2. Shortcodes

Shortcodes are a good way to create and display the custom functionality of your website to visitors. They are client-side bits of code. They can be placed in the posts and pages like in the menu and widgets, etc.

There are many plugins that use shortcodes. By creating your very own shortcode, you too can customize the WordPress plugin. You can create your own shortcode with the add_shortcode function. The name of the shortcode that you use would be the first variable and the second variable would be the output of it when it is triggered. The output can be – attributes, content, and name.

3. Widgets

Other than the hooks and shortcodes, you can use the widgets to add functionality to the site. WordPress Widgets are a good way to create a widget by extending the WP_Widget class. They render a user-friendly experience, as they have an object-oriented design approach and the functions and values are stored in a single entity.

How To Customize WordPress Plugins?

There are various methods to customize the WordPress plugins. Depending on your need, and the degree of customization you wish to make in the plugin, choose the right option for you. Also, don’t forget to keep in mind that it requires a little bit of technical knowledge too. So find an expert WordPress plugin development company in case you lack the knowledge to do it by yourself.

1. Hire A Plugin Developer3
This is image title

One of the best ways to customize a WordPress plugin is by hiring a plugin developer. There are many plugin developers listed in the WordPress directory. You can contact them and collaborate with world-class WordPress developers. It is quite easy to find a WordPress plugin developer.

Since it is not much work and doesn’t pay well or for the long term a lot of developers would be unwilling to collaborate but, you will eventually find people.

2. Creating A Supporting Plugin

If you are looking for added functionality in an already existing plugin go for this option. It is a cheap way to meet your needs and creating a supporting plugin takes very little time as it has very limited needs. Furthermore, you can extend a plugin to a current feature set without altering its base code.

However, to do so, you have to hire a WordPress developer as it also requires some technical knowledge.

3. Use Custom Hooks

Use the WordPress hooks to integrate some other feature into an existing plugin. You can add an action or a filter as per your need and improve the functionality of the website.

If the plugin you want to customize has the hook, you don’t have to do much to customize it. You can write your own plugin that works with these hooks. This way you don’t have to build a WordPress plugin right from scratch. If the hook is not present in the plugin code, you can contact a WordPress developer or write the code yourself. It may take some time, but it works.

Once the hook is added, you just have to manually patch each one upon the release of the new plugin update.

4. Override Callbacks

The last way to customize WordPress plugins is by override callbacks. You can alter the core functionality of the WordPress plugin with this method. You can completely change the way it functions with your website. It is a way to completely transform the plugin. By adding your own custom callbacks, you can create the exact functionality you desire.

We suggest you go for a web developer proficient in WordPress as this requires a good amount of technical knowledge and the working of a plugin.

Read More

#customize wordpress plugins #how to customize plugins in wordpress #how to customize wordpress plugins #how to edit plugins in wordpress #how to edit wordpress plugins #wordpress plugin customization

Top 7 Post Timeline WordPress Plugins

Want to feature a brand history or storyline on a WordPress website? If yes, then read this blog thoroughly.

Many of your website visitors want to know about your brand history or the achievements of your past. For that, a timeline layout is a good solution. Showcase the story of your company or brand in chronological order with the dazzling post timeline posts. WordPress has several themes that have default horizontal timeline formats. But, to get a fully functional & beautifully designed timeline WordPress has plenty of resources of timeline plugins.

No concerns! We have assembled the best post timeline WordPress plugins. Each set of plugins have different functionalities and customization settings. Get the best one and create a timeline with the best one!

1. WP Timeline Designer Pro

WP Timeline Designer is a feature-rich plugin that provides vertical and horizontal timeline templates with lots of advanced functionalities. While showcasing a story or company history with the beautiful chart or design then timeline layout helps to easily understand and attract the readers as well. A great way to tell a story or create a post then the timeline plugin helps to create an attractive timeline.

Timeline Designer – Free

Timeline Designer – a free plugin recently launched on the WordPress repository platform. The free plugin contains in-built 6 existing customizable layouts with other customization options. Using this WordPress plugin, a user can match the look & feel of your WordPress site.

Features:

  • Supports custom post type.
  • Provides the customization of background color, show/hide timeline icon, template layout color, and basic animations.
  • Style the post with the stunning content box.
  • With the Horizontal timeline layout, a user gets the navigation option such as auto slide, number of slides, scrolling speed, etc.
  • The plugin has Shortcode functionality with which a user can showcase timeline posts anywhere on the website.

WP Timeline Designer Pro – Premium

WP Timeline Designer Pro is an elegant and fantastic plugin with responsive timeline layouts. In the pro version, the plugin contains 15+ timeline templates with lots of options and tools to style and design the posts. It has in-built 20+ core demos available with which a user can showcase life story, event summary, author biography, achievements, company history, hiring process, etc in an eye-catchy timeline design.

Features:

  • 12+ post animation effects on scrolling.
  • Advanced filter post with the date, time period, author, post category, post status, etc.
  • 10+ social sharing icons available and available in the library to change the icon settings anytime.
  • The plugin allows you to add different types of pagination options such as load more buttons, pagination on scroll, etc.
  • The premium plugin contains several media options for timeline posts such as hover effect on images, adjust image size, or text. link on media, custom image size, etc.

2. Post Timeline

Post Timeline plugin allows creating a timeline on 100% of the page. It allows the creation of unlimited vertical and horizontal timelines. To create a simple and single timeline, a user can use shortcode functionality.

**Post Timeline – Free **

The Post Timeline Free plugin allows you to create a timeline on the vertical layout. A user can also assign the category and tags.

Features:

  • Smooth Animation & Slide Navigation is available.
  • The plugin helps to create a tag-based and year-based timeline with parameters.
  • The free plugin has customization offers such as color, assign different icons, etc.

Post Timeline – Premium

The pro version of the Post Timeline WordPress plugin has both vertical and horizontal timeline layouts. The plugin has inbuilt 23 timeline templates and all the timelines layout can be chosen by the admin for each timeline.

Features:

  • The plugin has CSS3 animation + JS animation to make the timeline post prettier.
  • Post Timeline comes with the backend template manager. It allows a user to preview the timeline on the page with the required content.
  • 5 navigation options available.

3. Cool Timeline

Cool Timeline, as its name suggests, creates a complete timeline layout for the WordPress website. It is an HTML and CSS timeline plugin that helps to build awesome horizontal and vertical layouts. The new version of the plugin is very well compatible with Gutenberg.

**Cool Timeline: Free **

The Cool Timeline with the free version has 5 vertical and one horizontal timeline design. Also, the plugin allows users to showcase the stories in ascending & descending orders based on the year and date.

Features:

  • It is a Gutenberg-friendly WordPress plugin with which a user can add shortcodes on any page using the Gutenberg block.
  • A user can showcase the timeline images in the pop-up and link them to read a full story.
  • Using this plugin, you can create a timeline both-sided as well as one-sided.

Cool TimelineCool Timeline: Premium

Cool Timeline Pro plugin has an advanced admin panel that helps to manage the timeline visibility details & other customization factors very smoothly. The premium plugin comes with 4 timeline layouts with 40+ several timeline designs.

Features:

  • It provides a custom text and custom story order in/place of date and time in a timeline layout.
  • Create multiple timelines in one website with the different categories
  • The plugin comes with the proper navigation options, so a user can quickly navigate to a particular story.

#best wordpress timeline plugin #post timeline plugin wordpress #post timeline wordpress #timeline plugin for wordpress #wordpress post timeline plugins #wordpress timeline plugin

Top 7 Post Timeline WordPress Plugins

Want to feature a brand history or storyline on a WordPress website? If yes, then read this blog thoroughly.

Many of your website visitors want to know about your brand history or the achievements of your past. For that, a timeline layout is a good solution. Showcase the story of your company or brand in chronological order with the dazzling post timeline posts. WordPress has several themes that have default horizontal timeline formats. But, to get a fully functional & beautifully designed timeline WordPress has plenty of resources of timeline plugins.

No concerns! We have assembled the best post timeline WordPress plugins. Each set of plugins have different functionalities and customization settings. Get the best one and create a timeline with the best one!

1. WP Timeline Designer Pro

WP Timeline Designer is a feature-rich plugin that provides vertical and horizontal timeline templates with lots of advanced functionalities. While showcasing a story or company history with the beautiful chart or design then timeline layout helps to easily understand and attract the readers as well. A great way to tell a story or create a post then the timeline plugin helps to create an attractive timeline.

Timeline Designer – Free

Timeline Designer – a free plugin recently launched on the WordPress repository platform. The free plugin contains in-built 6 existing customizable layouts with other customization options. Using this WordPress plugin, a user can match the look & feel of your WordPress site.
This is image title

Features:

  • Supports custom post type.
  • Provides the customization of background color, show/hide timeline icon, template layout color, and basic animations.
  • Style the post with the stunning content box.
  • With the Horizontal timeline layout, a user gets the navigation option such as auto slide, number of slides, scrolling speed, etc.
  • The plugin has Shortcode functionality with which a user can showcase timeline posts anywhere on the website.

WP Timeline Designer Pro – Premium

WP Timeline Designer Pro is an elegant and fantastic plugin with responsive timeline layouts. In the pro version, the plugin contains 15+ timeline templates with lots of options and tools to style and design the posts. It has in-built 20+ core demos available with which a user can showcase life story, event summary, author biography, achievements, company history, hiring process, etc in an eye-catchy timeline design.
This is image title

Features:

  • 12+ post animation effects on scrolling.
  • Advanced filter post with the date, time period, author, post category, post status, etc.
  • 10+ social sharing icons available and available in the library to change the icon settings anytime.
  • The plugin allows you to add different types of pagination options such as load more buttons, pagination on scroll, etc.
  • The premium plugin contains several media options for timeline posts such as hover effect on images, adjust image size, or text. link on media, custom image size, etc.

2. Post Timeline

Post Timeline plugin allows creating a timeline on 100% of the page. It allows the creation of unlimited vertical and horizontal timelines. To create a simple and single timeline, a user can use shortcode functionality.

**Post Timeline – Free **

The Post Timeline Free plugin allows you to create a timeline on the vertical layout. A user can also assign the category and tags.

Features:

  • Smooth Animation & Slide Navigation is available.
  • The plugin helps to create a tag-based and year-based timeline with parameters.
  • The free plugin has customization offers such as color, assign different icons, etc.
    This is image title

Post Timeline – Premium

The pro version of the Post Timeline WordPress plugin has both vertical and horizontal timeline layouts. The plugin has inbuilt 23 timeline templates and all the timelines layout can be chosen by the admin for each timeline.

Features:

  • The plugin has CSS3 animation + JS animation to make the timeline post prettier.
  • Post Timeline comes with the backend template manager. It allows a user to preview the timeline on the page with the required content.
  • 5 navigation options available.

3. Cool Timeline

Cool Timeline, as its name suggests, creates a complete timeline layout for the WordPress website. It is an HTML and CSS timeline plugin that helps to build awesome horizontal and vertical layouts. The new version of the plugin is very well compatible with Gutenberg.

**Cool Timeline: Free **

The Cool Timeline with the free version has 5 vertical and one horizontal timeline design. Also, the plugin allows users to showcase the stories in ascending & descending orders based on the year and date.

Features:

  • It is a Gutenberg-friendly WordPress plugin with which a user can add shortcodes on any page using the Gutenberg block.
  • A user can showcase the timeline images in the pop-up and link them to read a full story.
  • Using this plugin, you can create a timeline both-sided as well as one-sided.
    This is image title

Cool TimelineCool Timeline: Premium

Cool Timeline Pro plugin has an advanced admin panel that helps to manage the timeline visibility details & other customization factors very smoothly. The premium plugin comes with 4 timeline layouts with 40+ several timeline designs.

Features:

  • It provides a custom text and custom story order in/place of date and time in a timeline layout.
  • Create multiple timelines in one website with the different categories
  • The plugin comes with the proper navigation options, so a user can quickly navigate to a particular story.

#best wordpress timeline plugin #post timeline plugin wordpress #post timeline wordpress #timeline plugin for wordpress #wordpress post timeline plugins #wordpress timeline plugin

7 Best Video Player and Gallery Plugins for WordPress Website in 2021

When you want to watch a video, then you always choose to watch videos on YouTube and go for other popular streaming websites. Although such videos provide amazing watching experience and if you want to make own website that simply allows spectators to watch videos also. At that time you can prefer WordPress, even this is not only that, businesses which mostly tend to make video content and register them on their website. Therefore, you need video player WordPress plugins that makes simpler the entire procedures of dealing with videos on your website. Along with, you get remarkable video players that make an appealing appearance on your website.

Best Video Player WordPress Plugins

WP Video Lightbox

This is image title

WP Video LightboxWordPress plugin lets users insert videos right on top of any page by implementing a lightbox intersection screen. The plugin is very convenient when you are keen to show pictures, flash, YouTube, or Vimeo videos on your website. In addition, the plugin is fully approachable, thus, all mobile users like its amazing features.

The plugin assists you by automatically appealing the thumbnail for the Video which you make use of it, although you have a great choice to utilize your thumbnails if you wish for. The plugin also offers you an ideal alternative to restrict recommended video in the last part of a YouTube video, therefore your viewers will not to be unfocused. Additionally, you can buy antivirus online using Amazon Promo Code to protect your system form virus.

Portfolio Designer

This is image title

Portfolio Designer is a complete solution for developing an astonishing portfolio, galleries, as well showcase into the WordPress website. The plugin has in-built infinite layout styles such as grid, masonry, slider, WooCommerce, and justify. Additionally, it includes 50+ awesome hover and animation effects to captivate your website visitors instantly. This plugin supports audio and video formats to create fantastic galleries hassle-free.

The plugin has unlimited colors and design options that a user can modify smoothly and introduce the portfolio presentation vividly. It has 800+ Google web fonts, fancy box integration, support unlimited custom post, and so on. A user can get all the functionalities to build an attractive portfolio in just one plugin. With the Portfolio Designer WordPress plugin, there are no restrictions to display the portfolio or galleries to any website page. The plugin is also available in the lite version at the WordPress repository.

ARVE Advanced Responsive Video Embedder

This is image title

ARVE Advanced Responsive Video Embedder a well-known and great video implanting plugin for WordPress that is absolutely free of cost. The plugin is packed with multiple amazing features to grab each particular problem you are expected to expression by displaying such videos on your website.

Most importantly, this plugin allows to create the entire videos you insert into responsive videos and this is done just because of your mobile users can take pleasure such astounding experiences with hassle-free. Other alternatives comprise WYSIWYG support, auto-start videos, tweaking URL factors if you wish for, transforming video position, and lots more.

Find more plugins here.

#best wordpress plugins #best wp video plugin #video gallery wordpress plugin #wordpress gallery plugin #wordpress video plugin

Leonard  Paucek

Leonard Paucek

1656280800

Jump to Local IDE Code Directly From Browser React Component

React Dev Inspector

Jump to local IDE code directly from browser React component by just a simple click

This package allows users to jump to local IDE code directly from browser React component by just a simple click, which is similar to Chrome inspector but more advanced.

View Demo View Github

Preview

press hotkey (ctrl⌃ + shift⇧ + commmand⌘ + c), then click the HTML element you wish to inspect.

screen record gif (8M size):

Jump to local IDE code directly from browser React component by just a simple click

Installation

npm i -D react-dev-inspector

Usage

Users need to add React component and apply webpack config before connecting your React project with 'react-dev-inspector'.

Note: You should NOT use this package, and React component, webpack config in production mode


 

1. Add Inspector React Component

import React from 'react'
import { Inspector, InspectParams } from 'react-dev-inspector'

const InspectorWrapper = process.env.NODE_ENV === 'development'
  ? Inspector
  : React.Fragment

export const Layout = () => {
  // ...

  return (
     {}}
      onClickElement={(params: InspectParams) => {}}
    >
     
       ...
     
    
  )
}


 

2. Set up Inspector Config

You should add:

  • an inspector babel plugin, to inject source code location info
    • react-dev-inspector/plugins/babel
  • an server api middleware, to open local IDE
    • import { launchEditorMiddleware } from 'react-dev-inspector/plugins/webpack'

to your current project development config.

Such as add babel plugin into your .babelrc or webpack babel-loader config,
add api middleware into your webpack-dev-server config or other server setup.


 

There are some example ways to set up, please pick the one fit your project best.

In common cases, if you're using webpack, you can see #raw-webpack-config,

If your project happen to use vite / nextjs / create-react-app and so on, you can also try out our integrated plugins / examples with

raw webpack config

Example:

// .babelrc.js
module.exports = {
  plugins: [
    /**
     * react-dev-inspector plugin, options docs see:
     * https://github.com/zthxxx/react-dev-inspector#inspector-babel-plugin-options
     */
    'react-dev-inspector/plugins/babel',
  ],
}
// webpack.config.ts
import type { Configuration } from 'webpack'
import { launchEditorMiddleware } from 'react-dev-inspector/plugins/webpack'

const config: Configuration = {
  /**
   * [server side] webpack dev server side middleware for launch IDE app
   */
  devServer: {
    before: (app) => {
      app.use(launchEditorMiddleware)
    },
  },
}


 

usage with Vite2

example project see: https://github.com/zthxxx/react-dev-inspector/tree/master/examples/vite2

example vite.config.ts:

import { defineConfig } from 'vite'
import { inspectorServer } from 'react-dev-inspector/plugins/vite'

export default defineConfig({
  plugins: [
    inspectorServer(),
  ],
})


 

usage with Next.js

use Next.js Custom Server + Customizing Babel Config

example project see: https://github.com/zthxxx/react-dev-inspector/tree/master/examples/nextjs

in server.js, example:

...

const {
  queryParserMiddleware,
  launchEditorMiddleware,
} = require('react-dev-inspector/plugins/webpack')

app.prepare().then(() => {
  createServer((req, res) => {
    /**
     * middlewares, from top to bottom
     */
    const middlewares = [
      /**
       * react-dev-inspector configuration two middlewares for nextjs
       */
      queryParserMiddleware,
      launchEditorMiddleware,

      /** Next.js default app handle */
        (req, res) => handle(req, res),
    ]

    const middlewarePipeline = middlewares.reduceRight(
      (next, middleware) => (
        () => { middleware(req, res, next) }
      ),
      () => {},
    )

    middlewarePipeline()

  }).listen(PORT, (err) => {
    if (err) throw err
    console.debug(`> Ready on http://localhost:${PORT}`)
  })
})

in package.json, example:

  "scripts": {
-    "dev": "next dev",
+    "dev": "node server.js",
    "build": "next build"
  }

in .babelrc.js, example:

module.exports = {
  plugins: [
    /**
     * react-dev-inspector plugin, options docs see:
     * https://github.com/zthxxx/react-dev-inspector#inspector-babel-plugin-options
     */
    'react-dev-inspector/plugins/babel',
  ],
}


 

usage with create-react-app

cra + react-app-rewired + customize-cra example config-overrides.js:

example project see: https://github.com/zthxxx/react-dev-inspector/tree/master/examples/cra

const { ReactInspectorPlugin } = require('react-dev-inspector/plugins/webpack')
const {
  addBabelPlugin,
  addWebpackPlugin,
} = require('customize-cra')

module.exports = override(
  addBabelPlugin([
    'react-dev-inspector/plugins/babel',
    // plugin options docs see:
    // https://github.com/zthxxx/react-dev-inspector#inspector-babel-plugin-options
    {
      excludes: [
        /xxxx-want-to-ignore/,
      ],
    },
  ]),
  addWebpackPlugin(
    new ReactInspectorPlugin(),
  ),
)


 

usage with Umi3

example project see: https://github.com/zthxxx/react-dev-inspector/tree/master/examples/umi3

Example .umirc.dev.ts:

// https://umijs.org/config/
import { defineConfig } from 'umi'

export default defineConfig({
  plugins: [
    'react-dev-inspector/plugins/umi/react-inspector',
  ],
  inspectorConfig: {
    // babel plugin options docs see:
    // https://github.com/zthxxx/react-dev-inspector#inspector-babel-plugin-options
    excludes: [],
  },
})


 

usage with Umi2

Example .umirc.dev.js:

import { launchEditorMiddleware } from 'react-dev-inspector/plugins/webpack'

export default {
  // ...
  extraBabelPlugins: [
    // plugin options docs see:
    // https://github.com/zthxxx/react-dev-inspector#inspector-babel-plugin-options
    'react-dev-inspector/plugins/babel',
  ],

  /**
   * And you need to set `false` to `dll` in `umi-plugin-react`,
   * becase these is a umi2 bug that `dll` cannot work with `devServer.before`
   *
   * https://github.com/umijs/umi/issues/2599
   * https://github.com/umijs/umi/issues/2161
   */
  chainWebpack(config, { webpack }) {
    const originBefore = config.toConfig().devServer

    config.devServer.before((app, server, compiler) => {
      
      app.use(launchEditorMiddleware)
      
      originBefore?.before?.(app, server, compiler)
    })

    return config  
  },
}

usage with Ice.js

Example build.json:

// https://ice.work/docs/guide/basic/build
{
  "plugins": [
    "react-dev-inspector/plugins/ice",
  ]
}


 

Examples Project Code


 

Configuration

Component Props

checkout TS definition under react-dev-inspector/es/Inspector.d.ts.

PropertyDescriptionTypeDefault
keysinspector hotkeys

supported keys see: https://github.com/jaywcjlove/hotkeys#supported-keys
string[]['control', 'shift', 'command', 'c']
disableLaunchEditordisable editor launching

(launch by default in dev Mode, but not in production mode)
booleanfalse
onHoverElementtriggered when mouse hover in inspector mode(params: InspectParams) => void-
onClickElementtriggered when mouse hover in inspector mode(params: InspectParams) => void-
// import type { InspectParams } from 'react-dev-inspector'

interface InspectParams {
  /** hover / click event target dom element */
  element: HTMLElement,
  /** nearest named react component fiber for dom element */
  fiber?: React.Fiber,
  /** source file line / column / path info for react component */
  codeInfo?: {
    lineNumber: string,
    columnNumber: string,
    /**
    * code source file relative path to dev-server cwd(current working directory)
    * need use with `react-dev-inspector/plugins/babel`
    */
    relativePath?: string,
    /**
    * code source file absolute path
    * just need use with `@babel/plugin-transform-react-jsx-source` which auto set by most framework
    */
    absolutePath?: string,
  },
  /** react component name for dom element */
  name?: string,
}


 

Inspector Babel Plugin Options

interface InspectorPluginOptions {
  /** override process.cwd() */
  cwd?: string,
  /** patterns to exclude matched files */
  excludes?: (string | RegExp)[],
}


 

Inspector Loader Props

// import type { ParserPlugin, ParserOptions } from '@babel/parser'
// import type { InspectorConfig } from 'react-dev-inspector/plugins/webpack'

interface InspectorConfig {
  /** patterns to exclude matched files */
  excludes?: (string | RegExp)[],
  /**
   * add extra plugins for babel parser
   * default is ['typescript', 'jsx', 'decorators-legacy', 'classProperties']
   */
  babelPlugins?: ParserPlugin[],
  /** extra babel parser options */
  babelOptions?: ParserOptions,
}


 

IDE / Editor config

This package uses react-dev-utils to launch your local IDE application, but, which one will be open?

In fact, it uses an environment variable named REACT_EDITOR to specify an IDE application, but if you do not set this variable, it will try to open a common IDE that you have open or installed once it is certified.

For example, if you want it always open VSCode when inspection clicked, set export REACT_EDITOR=code in your shell.


 

VSCode

install VSCode command line tools, see the official docs
install-vscode-cli

set env to shell, like .bashrc or .zshrc

export REACT_EDITOR=code


 

WebStorm

  • just set env with an absolute path to shell, like .bashrc or .zshrc (only MacOS)
export REACT_EDITOR='/Applications/WebStorm.app/Contents/MacOS/webstorm'

OR

install WebStorm command line tools
Jump to local IDE code directly from browser React component by just a simple click

then set env to shell, like .bashrc or .zshrc

export REACT_EDITOR=webstorm


 

Vim

Yes! you can also use vim if you want, just set env to shell

export REACT_EDITOR=vim


 

How It Works

Stage 1 - Compile Time

  • [babel plugin] inject source file path/line/column to JSX data attributes props

Stage 2 - Web React Runtime

[React component] Inspector Component in react, for listen hotkeys, and request api to dev-server for open IDE.

Specific, when you click a component DOM, the Inspector will try to obtain its source file info (path/line/column), then request launch-editor api (in stage 3) with absolute file path.

Stage 3 - Dev-server Side

[middleware] setup launchEditorMiddleware in webpack dev-server (or other dev-server), to open file in IDE according to the request params.

Only need in development mode,and you want to open IDE when click a component element.

Not need in prod mode, or you just want inspect dom without open IDE (set disableLaunchEditor={true} to Inspector component props)

Analysis of Theory


Author: zthxxx
Source code: https://github.com/zthxxx/react-dev-inspector
License: MIT license

#react-native #react