babel-plugin-remove-attribute

1.0.0 • Public • Published

babel-plugin-remove-attribute CircleCI npm version

Plugin to remove a single attribute from JSX elements.

Usage

.babelrc

{
  plugins: [
    ..., 
    ['babel-plugin-remove-attribute', { 
      attribute: (attribute name here),
    }], 
    ...,
  ],
}

Motivation

When locating elements for testing (e.g. React, Selenium), it's common to do so via a class on the element. This couples styling with testing though, so it's a better idea to use a custom attribute on the elements. You can then use the plugin for production code to remove these from the DOM, if you care enough.

Package Sidebar

Install

npm i babel-plugin-remove-attribute

Weekly Downloads

1,031

Version

1.0.0

License

MIT

Unpacked Size

2.98 kB

Total Files

5

Last publish

Collaborators

  • rtymchyk