Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/codemodsquad/babel-plugin-jsx-source-loc

add a prop like data-source-loc="src/foo.js:35:8" to every JSX element
https://github.com/codemodsquad/babel-plugin-jsx-source-loc

babel jsx react transforms

Last synced: 28 days ago
JSON representation

add a prop like data-source-loc="src/foo.js:35:8" to every JSX element

Awesome Lists containing this project

README

        

# babel-plugin-jsx-source-loc

[![CircleCI](https://circleci.com/gh/codemodsquad/babel-plugin-jsx-source-loc.svg?style=svg)](https://circleci.com/gh/codemodsquad/babel-plugin-jsx-source-loc)
[![Coverage Status](https://codecov.io/gh/codemodsquad/babel-plugin-jsx-source-loc/branch/master/graph/badge.svg)](https://codecov.io/gh/codemodsquad/babel-plugin-jsx-source-loc)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![npm version](https://badge.fury.io/js/babel-plugin-jsx-source-loc.svg)](https://badge.fury.io/js/babel-plugin-jsx-source-loc)

Adds a `data-source-loc` prop to every JSX element, so that you can quickly look up where an element was rendered
in the React Dev Tools. This is primarily intended for dev mode, not production.

# Example

### Input

```jsx
function MyComponent() {
return (



{names.map(name => (
{name}
))}


)
}
```

### output

```jsx
function MyComponent() {
return (



{names.map(name => (

{name}

))}


)
}
```

# Usage

```
npm i --save-dev babel-plugin-jsx-source-loc
```

And add `"babel-plugin-jsx-source-loc"` to your babel configuration.