-
Notifications
You must be signed in to change notification settings - Fork 60
/
gulpfile.js
54 lines (50 loc) · 1.49 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
var gulp = require("gulp"),
minifyCSS = require("gulp-minify-css"),
concat = require("gulp-concat"),
uglify = require("gulp-uglify"),
prefix = require("gulp-autoprefixer"),
sass = require("gulp-sass"),
sourcemaps = require("gulp-sourcemaps"),
rename = require("gulp-rename"),
rollup = require("gulp-better-rollup"),
babel = require("rollup-plugin-babel");
gulp.task("js", function() {
return gulp
.src("src/js/leaflet-gesture-handling.js")
.pipe(sourcemaps.init())
.pipe(
rollup(
{ plugins: [babel()] },
{
file: "dist/leaflet-gesture-handling.js",
format: "umd"
}
)
)
.pipe(gulp.dest("dist/"))
.pipe(uglify())
.pipe(rename({ extname: ".min.js" }))
.pipe(sourcemaps.write(""))
.pipe(gulp.dest("dist/"));
});
gulp.task("styles", function() {
return gulp
.src("src/scss/**/*.scss")
.pipe(sass())
.pipe(prefix("last 2 versions"))
.pipe(concat("leaflet-gesture-handling.css"))
.pipe(gulp.dest("dist/"))
.pipe(minifyCSS())
.pipe(rename({ extname: ".min.css" }))
.pipe(gulp.dest("dist/"));
});
gulp.task("dev", function() {
gulp.run("styles");
gulp.run("js");
gulp.watch("src/scss/*.scss", ["styles"]);
gulp.watch("src/js/*.js", ["js"]);
});
gulp.task("build", function() {
gulp.run("styles");
gulp.run("js");
});