2016-06-20 16:53:45 -04:00
|
|
|
const gulp = require("gulp"),
|
|
|
|
ugly = require("gulp-uglify"),
|
2017-11-13 21:00:00 -05:00
|
|
|
concat = require("gulp-concat"),
|
|
|
|
insert = require("gulp-insert");
|
2015-06-30 16:50:22 -04:00
|
|
|
|
2017-11-13 19:54:55 -05:00
|
|
|
gulp.task("module", function() {
|
2017-11-13 21:00:00 -05:00
|
|
|
return gulp.src([ "contain-element.js" ])
|
|
|
|
.pipe(insert.transform(function(contents) {
|
|
|
|
return contents
|
|
|
|
.replace(/^function ContainElement/, "module.exports = function")
|
|
|
|
.replace(/\n\}/, "\n};");
|
|
|
|
}))
|
2017-11-13 19:54:55 -05:00
|
|
|
.pipe(concat("contain-element-module.js"))
|
|
|
|
.pipe(gulp.dest("./"));
|
|
|
|
});
|
|
|
|
|
|
|
|
gulp.task("minify", function() {
|
2016-06-20 16:53:45 -04:00
|
|
|
return gulp.src("contain-element.js")
|
|
|
|
.pipe(ugly())
|
|
|
|
.pipe(concat("contain-element.min.js"))
|
|
|
|
.pipe(gulp.dest("./"));
|
2015-06-30 16:50:22 -04:00
|
|
|
});
|
|
|
|
|
2018-05-11 15:00:36 -04:00
|
|
|
gulp.task("default", gulp.parallel(
|
2017-11-13 19:54:55 -05:00
|
|
|
"module",
|
|
|
|
"minify"
|
2018-05-11 15:00:36 -04:00
|
|
|
));
|