forked from Viglino/ol-ext
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
79 lines (72 loc) · 2.2 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/** Gulp file to create dist
*/
var gulp = require("gulp");
var concat = require("gulp-concat");
var cssnext = require("gulp-cssnext");
var minify = require("gulp-minify")
var header = require('gulp-header');
// Retrieve option (--debug for css)
var options = require("minimist")(process.argv.slice(2));
// using data from package.json
var pkg = require('./package.json');
var banner = ['/**',
' * <%= pkg.name %> - <%= pkg.description %>',
' * @abstract <%= pkg.keywords %>',
' * @version v<%= pkg.version %>',
' * @author <%= pkg.author %>',
' * @link <%= pkg.homepage %>',
' * @license <%= pkg.license %>',
' */',
''].join('\n');
// Build css. Use --debug to build in debug mode
gulp.task("css", function() {
gulp.src([
"./control/*.css", "!./control/piratecontrol.css",
"./featureanimation/*.css",
"./filter/*.css",
"./interaction/*.css",
"./layer/*.css",
"./overlay/*.css", "!./overlay/popupoverlay.anim.css",
"./style/*.css",
"./utils/*.css"
])
.pipe(cssnext({
compress: !options.debug,
sourcemap: options.debug
}))
.pipe(concat("ol3-ext"+(!options.debug?".min.css":".css")))
.pipe(gulp.dest("./dist/"))
});
// Build css in debug mode
gulp.task("cssd", function() {
options.debug = true;
gulp.start("css");
});
// Build js
gulp.task("js", function() {
gulp.src([
"./control/layerswitchercontrol.js", "./control/*.js", "!./control/piratecontrol.js",
"./featureanimation/featureanimation.js", "./featureanimation/*.js",
"./filter/filter.js", "./filter/maskfilter.js", "./filter/*.js",
"./interaction/*.js",
"./layer/*.js",
"./overlay/*.js",
"./style/fontsymbol.js", "./style/*.js", "!./style/*.def.js",
"./utils/*.js", "!./utils/ol.map.pulse.js", "!./utils/ol.map.markup.js",
"!./*/*.min.js",
"!./*/texturefilterimage.js"
])
.pipe(concat("ol3-ext.js"))
.pipe(minify(
{ ext: {
src:".js",
min:".min.js"
}
}))
.pipe(header(banner, { pkg : pkg } ))
.pipe(gulp.dest("./dist/"))
});
// build the dist
gulp.task("dist", ["js","css","cssd"]);
// The default task that will be run if no task is supplied
gulp.task("default", ["js","css","cssd"]);