gulp-class-implements-polymerjs v1.0.0
gulp-class-implements-polymerjs
A plugin for gulp that is meant to be combined with the npm package polymerjs that will parse Javascript class signatures for 'implements' statements and replace them with a 'implementsInterface' method call.
Installation
$ npm install gulp-class-implements-polymerjs --save-devUse case
As stated, this plugin is exclusively meant for operation with the polymerjs npm package.
This plugin is meant for this kind of scenario:
class AwesomeClass implements CoolInterfaceThe implements property is NOT part of the official ES2015 module spec. Be aware that the semantics this plugin expects isn't and probably never will be officially supported.
The gulp plugin will then correct the class signature and instead append a implementsInterface(<Class>, <Interface>) method call to the bottom of the file.
If the implementsInterface method of the polymerjs/register file is not already loaded, this plugin will do it automatically and append it to the top of the class file.
It compiles to this:
import {implementsInterface} from "polymerjs/register";
import CoolInterface from "../interfaces/CoolInterface";
class AwesomeClass {
/* Code */
}
implementsInterface(AwesomeClass, CoolInterface);Usage
Simply add it to your gulpfile.js:
const INTERFACE_EXTENSION = require('gulp-class-implements-polymerjs');
gulp.src("./assets/**/*.*")
.pipe(INTERFACE_EXTENSION())
.pipe(gulp.dest(COMPILED_DIRECTORY + "/components"));License
Copyright (c) 2016 Dlmma IVS. Released under the MIT license.
9 years ago