This repository has been archived by the owner on Apr 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 47
/
gulpfile.js
87 lines (76 loc) · 1.89 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
'use strict';
const del = require('del');
const gulp = require('gulp');
const sass = require('gulp-sass');
const cssmin = require('gulp-cssmin');
const concat = require('gulp-concat');
const uglify = require('gulp-uglify');
const BrowserSync = require('browser-sync');
const browserSync = BrowserSync.create();
const paths = {
clean: [],
templates: [],
styles: {
sources: [
'node_modules/font-awesome/scss/*.scss',
'node_modules/bootstrap/scss/*.scss',
'web/scss/**/*.scss',
],
concat: 'main.min.css',
dest: 'web/css'
},
scripts: {
sources: [
'node_modules/tether/dist/js/tether.js',
'node_modules/jquery/dist/jquery.min.js',
'node_modules/bootstrap/dist/js/bootstrap.min.js',
],
concat: 'main.min.js',
dest: 'web/js'
}
};
function clean() {
return del(paths.clean);
}
function styles() {
return gulp.src(paths.styles.sources)
.pipe(sass())
.pipe(cssmin())
.pipe(concat(paths.styles.concat))
.pipe(gulp.dest(paths.styles.dest))
.pipe(browserSync.stream())
}
function scripts() {
return gulp.src(paths.scripts.sources)
.pipe(uglify())
.pipe(concat(paths.scripts.concat))
.pipe(gulp.dest(paths.scripts.dest))
.pipe(browserSync.stream());
}
function serve() {
browserSync.init({
proxy: 'symfony-docker.dev:81',
open: false,
});
}
function watch() {
gulp.watch(paths.styles.sources, styles);
gulp.watch(paths.scripts.sources, scripts);
gulp.watch(paths.templates).on('change', browserSync.reload);
}
const build = gulp.series(
clean,
gulp.parallel(
styles,
scripts
)
);
const dev = gulp.series(
build,
gulp.parallel(
serve,
watch
)
);
gulp.task('build', build);
gulp.task('default', dev);