mirror of
https://github.com/github/babel-plugin-ensure-name-for-custom-elements
synced 2026-07-21 13:43:43 +00:00
No description
- JavaScript 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| src | ||
| test | ||
| .babelrc | ||
| .eslintignore | ||
| .eslintrc.json | ||
| .gitignore | ||
| .npmignore | ||
| .travis.yml | ||
| LICENSE | ||
| package-lock.json | ||
| package.json | ||
| prettier.config.js | ||
| README.md | ||
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"]
});