Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

github/babel-plugin-ensure-name-for-custom-elements

Repository files navigation

babel-plugin-ensure-name-for-custom-elements

This plugin makes sure that your custom elements always have a name property, even after minifying.

Example

In

class FooElement extends HTMLElement { }

Out

class FooElement extends HTMLElement {
  static get name() {
    return "FooElement";
  }
}

Installation

$ npm install babel-plugin-ensure-name-for-custom-elements

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["ensure-name-for-custom-elements"]
}

Via CLI

$ babel --plugins ensure-name-for-custom-elements script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["ensure-name-for-custom-elements"]
});

About

This plugin makes sure that your custom elements always have a name property, even after minifying.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published