0.2.0 • Published 6 years ago
gulp-aegean v0.2.0
gulp-aegean
Gulp plugin for aegean (ES6 inline import).
const gulp = require('gulp');
const aegean = require('gulp-aegean');
gulp.task('js', function() {
return gulp.src('src/**/*.js')
.pipe(aegean())
.pipe(gulp.dest('dist'));
});
Summary
Installation
With npm:
npm install --save-dev gulp-aegean
With yarn:
yarn add --dev gulp-aegean
Usage
Example 1: simple usage
src/main.js
import "./echo";
import "./is_string";
const input = "hello world";
if(is_string(input) === true) {
echo(input);
}
gulpfile.js
const gulp = require('gulp');
const aegean = require('gulp-aegean');
gulp.task('js', function() {
return gulp.src('src/**/*.js')
.pipe(aegean())
.pipe(gulp.dest('dist'));
});
Result:
dist/main.js
function echo(mixed) {
console.log(mixed);
}
function is_string(mixed) {
return (
mixed !== null && mixed !== undefined && mixed.constructor === String
);
}
const input = "hello world";
if (is_string(input) === true) {
echo(input);
}