wireapp/babel-plugin-remove-jsx-attributes

Name: babel-plugin-remove-jsx-attributes

Owner: Wire Swiss GmbH

Description: Babel plugin for removing attributes from JSX elements

Created: 2017-12-21 15:47:23.0

Updated: 2018-02-06 17:08:29.0

Pushed: 2018-01-10 09:39:53.0

Homepage: https://www.npmjs.com/package/babel-plugin-remove-jsx-attributes

Size: 33

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Wire

This repository is part of the source code of Wire. You can find more information at wire.com or by contacting opensource@wire.com.

You can find the published source code at github.com/wireapp.

For licensing information, see the attached LICENSE file and the list of third-party licenses at wire.com/legal/licenses/.

babel-plugin-remove-jsx-attributes

This plugin removes attributes from JSX elements. This can be useful in situations where you want to have specific attributes removed for production.

Requiremets
Usage
Install
rn add --dev babel-plugin-remove-jsx-attributes

m install --save-dev babel-plugin-remove-jsx-attributes
Configuration

When adding babel-plugin-remove-jsx-attributes to your .babelrc file, you can specify the patterns of attributes to remove by using the regular expression form.


lugins": [
[
  "remove-jsx-attributes",
  {"patterns": [
    '^myAttribute$'
  ]}
]

resets": ["react"]

In the example above babel-plugin-remove-jsx-attributes will remove all attributes that match the regular expression ^myAttribute$ before transpiling them to React.createComponent.

rt React from 'react';

t func = () => (<div className="myClass" myAttribute="value" />);

Would be transpiled to:

rt React from 'react';

t func = () => React.createElement("div", { className: "myClass" });
Development
Install
rn
Test
rn test

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.