Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zdychacek/babel-plugin-ng-inject-classes
Annotates decorated AngularJS classes.
https://github.com/zdychacek/babel-plugin-ng-inject-classes
angular babel babel-plugin decorators es2015 inject
Last synced: 8 days ago
JSON representation
Annotates decorated AngularJS classes.
- Host: GitHub
- URL: https://github.com/zdychacek/babel-plugin-ng-inject-classes
- Owner: zdychacek
- Created: 2017-07-26T14:46:31.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-07-27T10:41:25.000Z (over 7 years ago)
- Last Synced: 2024-12-09T04:51:49.682Z (about 1 month ago)
- Topics: angular, babel, babel-plugin, decorators, es2015, inject
- Language: JavaScript
- Homepage:
- Size: 8.79 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# babel-plugin-ng-inject-classes
Annotates decorated AngularJS classes.
## How to install
```
npm install @zdychacek/babel-plugin-ng-inject-classes --save-dev
```Note: this library depends on the [syntax decorators](https://www.npmjs.com/package/babel-plugin-syntax-decorators) plugin for parsing. Simply type `npm install babel-plugin-syntax-decorators --save-dev`.
## How to setup
#### .babelrc
```js
{
"presets": [ "es2015" ],
"plugins": [
"syntax-decorators",
[
"@zdychacek/babel-plugin-ng-inject-classes", {
"decoratorNames": [ "Component" ]
}
]
]
}
```This plugin takes one option - `decoratorNames`. This option allows you to define list of decorator names to parse.
## How to use
Transforms this code:
```js
@Component('foo')
class Foo {
constructor($timeout, $element) {}
}
```into this:
```js
@Component('foo')
class Foo {
constructor($timeout, $element) {}
}
Foo.$inject = ['$timeout', '$element'];
```