-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
79 lines (61 loc) · 1.85 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
const gulp = require('gulp');
const sass = require('gulp-sass')(require('sass'));
const autoprefixer = require('gulp-autoprefixer');
const browserSync = require('browser-sync').create();
const concat = require('gulp-concat');
const babel = require('gulp-babel');
const uglify = require('gulp-uglify');
function compilaSass() {
return gulp.src('scss/*.scss')
.pipe(sass({outputStyle : 'compressed'}))
.pipe(autoprefixer({
overrideBrowserslist: ['last 2 versions'],
cascade: false,
}))
.pipe(gulp.dest('css/'))
.pipe(browserSync.stream());
}
gulp.task('sass', compilaSass);
function pluginsCSS() {
return gulp.src('css/lib/*.css')
.pipe(concat('plugins.css'))
.pipe(gulp.dest('css/'))
.pipe(browserSync.stream());
}
gulp.task('plugincss', pluginsCSS);
function gulpJs() {
return gulp.src('js/scripts/*.js')
.pipe(concat('all.js'))
.pipe(babel({
presets: ['@babel/env']
}))
.pipe(uglify())
.pipe(gulp.dest('js/'))
.pipe(browserSync.stream());
}
gulp.task('alljs', gulpJs);
function pluginsJs() {
return gulp
.src(['./js/lib/jquery.min.js', './js/lib/jquery-marquee.min.js','./js/lib/gsap.min.js', './js/lib/luge.min.js'])
.pipe(concat('plugins.js'))
.pipe(gulp.dest('js/'))
.pipe(browserSync.stream())
}
gulp.task('pluginjs', pluginsJs);
function browser() {
browserSync.init({
server: {
baseDir: './'
}
})
}
gulp.task('browser-sync', browser);
function watch() {
gulp.watch('scss/*.scss', compilaSass);
gulp.watch('css/lib/*.css', pluginsCSS);
gulp.watch('*.html').on('change', browserSync.reload);
gulp.watch('js/scripts/*js', gulpJs);
gulp.watch('js/lib/*.js', pluginsJs);
}
gulp.task('watch', watch)
gulp.task('default', gulp.parallel('watch', 'browser-sync', 'sass', 'plugincss' , 'alljs', 'pluginjs'));