All Projects → oliviertassinari → Babel Plugin React Remove Properties

oliviertassinari / Babel Plugin React Remove Properties

Babel plugin for removing React properties. 💨

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Babel Plugin React Remove Properties

Babel Plugin Styled Components
Improve the debugging experience and add server-side rendering support to styled-components
Stars: ✭ 878 (+168.5%)
Mutual labels:  minification, babel, babel-plugin
Babel Plugin Transform React Remove Prop Types
Remove unnecessary React propTypes from the production build. 🎈
Stars: ✭ 890 (+172.17%)
Mutual labels:  minification, babel, babel-plugin
Babel Plugin Tailwind Components
Use Tailwind with any CSS-in-JS library
Stars: ✭ 320 (-2.14%)
Mutual labels:  babel, babel-plugin
babel-plugin-source-map-support
A Babel plugin which automatically makes stack traces source-map aware
Stars: ✭ 41 (-87.46%)
Mutual labels:  babel, babel-plugin
Babel Plugin Css Modules Transform
Extract css class names from required css module files, so we can render it on server.
Stars: ✭ 318 (-2.75%)
Mutual labels:  babel, babel-plugin
babel-plugin-proposal-pattern-matching
the minimal grammar, high performance JavaScript pattern matching implementation
Stars: ✭ 34 (-89.6%)
Mutual labels:  babel, babel-plugin
babel-plugin-private-underscores
Make _classMembers 'private' using symbols
Stars: ✭ 39 (-88.07%)
Mutual labels:  babel, properties
babel-plugin-transform-html-import-to-string
Turn HTML imports (and export from) into constant strings
Stars: ✭ 22 (-93.27%)
Mutual labels:  babel, babel-plugin
babel-plugin-syntax-pipeline
Allow parsing of pipeline operator |>
Stars: ✭ 23 (-92.97%)
Mutual labels:  babel, babel-plugin
Grafoo
A GraphQL Client and Toolkit
Stars: ✭ 264 (-19.27%)
Mutual labels:  babel, babel-plugin
Babel Blade
(under new management!) ⛸️Solve the Double Declaration problem with inline GraphQL. Babel plugin/macro that works with any GraphQL client!
Stars: ✭ 266 (-18.65%)
Mutual labels:  babel, babel-plugin
Static Html Webpack Boilerplate
🔮 modern tooling for old-school static webpage development
Stars: ✭ 226 (-30.89%)
Mutual labels:  minification, babel
Static Site Boilerplate
A better workflow for building modern static websites.
Stars: ✭ 1,633 (+399.39%)
Mutual labels:  minification, babel
core-web
like core-js but for Web APIs (based on polyfill.io)
Stars: ✭ 34 (-89.6%)
Mutual labels:  babel, babel-plugin
Esbuild Loader
⚡️ Speed up your Webpack build with esbuild
Stars: ✭ 1,245 (+280.73%)
Mutual labels:  minification, babel
babel-plugin-transform-replace-expressions
A Babel plugin for replacing expressions with other expressions
Stars: ✭ 23 (-92.97%)
Mutual labels:  babel, babel-plugin
S2s
Coding time Compile. A tool to write code fastest.
Stars: ✭ 254 (-22.32%)
Mutual labels:  babel, babel-plugin
Babel Plugin Module Resolver
Custom module resolver plugin for Babel
Stars: ✭ 3,134 (+858.41%)
Mutual labels:  babel, babel-plugin
babel-plugin-remove-test-ids
🐠 Babel plugin to strip `data-test-id` HTML attributes
Stars: ✭ 40 (-87.77%)
Mutual labels:  babel, babel-plugin
Babel Plugin Console
Babel Plugin that adds useful build time console functions 🎮
Stars: ✭ 278 (-14.98%)
Mutual labels:  babel, babel-plugin

babel-plugin-react-remove-properties

Babel plugin for removing React properties.

npm version npm downloads Build Status

Dependencies DevDependencies

Installation

npm install --save-dev babel-plugin-react-remove-properties

The problem solved

This is useful when using selectors like data-test to run selenium test. Those properties are useless when running the code in production. You can save bandwidth by removing them.

Example

In

class Foo extends React.Component {
  render() {
    return (
      <div className="bar" data-test="thisIsASelectorForSelenium">
        Hello Wold!
      </div>
    );
  }
}

Out

class Foo extends React.Component {
  render() {
    return (
      <div className="bar">
        Hello Wold!
      </div>
    );
  }
}

Usage

Via .babelrc (Recommended)

.babelrc

without options:

{
  "env": {
    "production": {
      "plugins": [
        "react-remove-properties"
      ]
    }
  }
}

with options. We accepts an array of property names that can be either strings or regular expressions:

{
  "env": {
    "production": {
      "plugins": [
        ["react-remove-properties", {"properties": ["data-test", "data-foo", /my-suffix-expression$/]}]
      ]
    }
  }
}

Via CLI

babel --plugins react-remove-properties script.js

Via Node API

without options:

require('babel-core').transform('code', {
  plugins: [
    'react-remove-properties',
  ],
});

with options:

require('babel-core').transform('code', {
  plugins: [
    ['react-remove-properties', {properties: ['data-test', 'data-foo', /my-suffix-expression$/]}],
  ],
});

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].