babel-plugin-app-decorators-component
Babel Plugin for extend HTMLElement by options for Babeljs v6.x
Installation
$ npm install babel-plugin-app-decorators-component --save
Usage
.babelrc
(Recommended)
Via .babelrc
Note: Order of Plugins Matters!
If you including your plugin app-decorators-component
, make sure that app-decorators-component
comes before all plugins or if you using transform-decorators-legacy
before that.
// WRONG"plugins": "plugin-1" "plugin-2" "plugin-3" "app-decorators-component" // RIGHT"plugins": "app-decorators-component" "plugin-1" "plugin-2" "plugin-3"
See also notes: https://github.com/loganfsmyth/babel-plugin-transform-decorators-legacy
Via CLI
$ babel --plugins app-decorators-component script.js
Via Node API
;
The goal of this babel-plugin for app-decorators @component:
Example 1
code:
@
transformed:
;@HTMLElement
Example 2
code:
@
transformed:
;@HTMLImageElement static { return 'img'; }
Not possible at the moment:
{} @
Use dependency-Injection instead:
Tests
git clone https://github.com/SerkanSipahi/app-decorators.gitcd app-decorators/packages/babel-plugin-app-decorators-componentmake installmake test