-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
executable file
·90 lines (83 loc) · 2.26 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
80
81
82
83
84
85
86
87
88
89
90
const gulp = require('gulp');
const concat = require('gulp-concat');
const csso = require('gulp-csso');
const autoprefixer = require('gulp-autoprefixer');
const sass = require('gulp-sass');
const size = require("gulp-size");
const gzip = require("gulp-gzip");
const rename = require("gulp-rename")
sass.compiler = require('node-sass');
/**
* Task: gulp css
*/
gulp.task("css", function () {
return gulp
.src([
// Flatpickr
'node_modules/flatpickr/dist/flatpickr.min.css',
// Blocks
'blocks/Flatpickr/block.scss',
])
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer({
overrideBrowserslist: [
"last 1 version"
],
cascade: false
}))
.pipe(csso())
.pipe(concat('flatpickr.min.css'))
.pipe(gulp.dest("blocks/Flatpickr/dist/css/"))
.pipe(size({ showFiles: true }))
.pipe(gzip())
.pipe(rename("flatpickr.min.css.gz"))
.pipe(gulp.dest("blocks/Flatpickr/dist/css/"))
.pipe(size({ showFiles: true, gzip: true }));
});
/**
* Task: gulp js
*/
gulp.task('js', function () {
return gulp
.src([
// Flatpickr
'node_modules/flatpickr/dist/flatpickr.min.js',
// Blocks
'blocks/Flatpickr/block.js'
])
.pipe(concat('flatpickr.min.js'))
.pipe(size({ showFiles: true }))
.pipe(gulp.dest('blocks/Flatpickr/dist/js/'))
.pipe(gzip())
.pipe(rename("flatpickr.min.js.gz"))
.pipe(gulp.dest("blocks/Flatpickr/dist/js/"))
.pipe(size({ showFiles: true, gzip: true }));
});
/**
* Task: gulp flatpickr-langs
*/
gulp.task('flatpickr-langs', function () {
return gulp
.src(['node_modules/flatpickr/dist/*l10n/**/*.js'])
.pipe(size({ showFiles: true }))
.pipe(gulp.dest('blocks/Flatpickr/dist/lang/flatpickr'));
});
/**
* Task: gulp default
*/
gulp.task('default',
gulp.series(
'flatpickr-langs',
'css',
'js'
)
);
/**
* Task: gulp watch
*/
gulp.task('watch', function () {
gulp.watch(
["blocks/**/*.html", "assets/src/"],
gulp.series('default')
);
});