-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
66 lines (57 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
let gulp = require('gulp'),
sass = require('gulp-sass'),
rename = require('gulp-rename'),
browserSync = require('browser-sync'),
autoprefixer = require('gulp-autoprefixer'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
cssmin = require('gulp-cssmin');
gulp.task('sass', function(){
return gulp.src('app/scss/style.scss')
.pipe(sass({outputStyle: 'expanded'}))
.pipe(rename({suffix: '.min'}))
.pipe(autoprefixer({
overrideBrowserslist: ['last 8 versions']
}))
.pipe(gulp.dest('app/css'))
.pipe(browserSync.reload({stream: true}))
});
gulp.task('style', function(){
return gulp.src([
'node_modules/normalize.css/normalize.css'
// 'node_modules/slick-carousel/slick/slick.css'
])
.pipe(concat('libs.min.css'))
.pipe(cssmin())
.pipe(gulp.dest('app/css'))
});
gulp.task('script', function(){
return gulp.src([
'node_modules/slick-carousel/slick/slick.js'
// 'node_modules/magnific-popup/dist/jquery.magnific-popup.js'
])
.pipe(concat('libs.min.js'))
.pipe(uglify())
.pipe(gulp.dest('app/js'))
});
gulp.task('html', function(){
return gulp.src('app/*.html')
.pipe(browserSync.reload({stream: true}))
});
gulp.task('js', function(){
return gulp.src('app/js/*.js')
.pipe(browserSync.reload({stream: true}))
});
gulp.task('browser-sync', function(){
browserSync.init({
server: {
baseDir: 'app/'
}
});
});
gulp.task('watch', function(){
gulp.watch('app/scss/**/*.scss', gulp.parallel('sass'));
gulp.watch('app/*.html', gulp.parallel('html'));
gulp.watch('app/js/*.js', gulp.parallel('js'));
});
gulp.task('default', gulp.parallel('style', 'script', 'sass', 'watch', 'browser-sync'));