forked from fancyapps/fancybox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
76 lines (63 loc) · 1.96 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
/* jshint node: true */
/* global $: true */
"use strict";
var gulp = require("gulp"),
$ = require("gulp-load-plugins")();
var config = {
js: [
"lib/jquery.mousewheel.pack.js",
"source/jquery.fancybox.pack.js",
"source/helpers/jquery.fancybox-buttons.js",
"source/helpers/jquery.fancybox-thumbs.js",
"source/helpers/jquery.fancybox-media.js"
],
css: [
"source/jquery.fancybox.css",
"source/helpers/jquery.fancybox-buttons.css",
"source/helpers/jquery.fancybox-thumbs.css"
],
images: [
"source/helpers/**/*.{jpg,png,svg,gif,webp,ico}",
"source/*.{jpg,png,svg,gif,webp,ico}"
]
},
dist = {
images: "dist/images/fancybox",
css: "dist/css",
js: "dist/js"
};
/*
- |--------------------------------------------------------------------------
- | Gulp Front Tasks
- |--------------------------------------------------------------------------
- |
+ *
+ *
*/
gulp.task("clean", function () {
return gulp.src("dist", {read: false})
.pipe($.clean());
});
gulp.task("scripts", function () {
return gulp.src(config.js)
.pipe($.plumberNotifier())
.pipe($.concat("jquery.fancybox.min.js"))
.pipe($.uglify())
.pipe(gulp.dest(dist.js));
});
gulp.task("styles", function () {
return gulp.src(config.css)
.pipe($.plumberNotifier())
.pipe($.concat("jquery.fancybox.min.css"))
.pipe($.autoprefixer("last 5 version"))
.pipe($.replace(/url\('?(.*)'?\)/g, "url('../images/fancybox/$1')"))
.pipe($.replace("''", "'"))
.pipe($.cleanCss({compatibility: 'ie8'}))
.pipe(gulp.dest(dist.css))
});
gulp.task("images", function () {
return gulp.src(config.images)
.pipe($.newer(dist.images))
.pipe(gulp.dest(dist.images));
});
gulp.task('default', ["images", "styles", "scripts"]);