-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
77 lines (65 loc) · 2.11 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
const gulp = require('gulp'),
autoprefixer = require('gulp-autoprefixer'),
concat = require('gulp-concat');
sass = require('gulp-sass'),
browserSync = require('browser-sync').create();
responsive = require('gulp-responsive');
imgMin = require('gulp-imagemin');
gulp.task('js', () => {
gulp.src('./src/services/*.js')
.pipe(concat('services.js'))
.pipe(gulp.dest('./public/js/'))
.pipe(gulp.dest('./docs/js/'));
gulp.src('./src/components/**/*.js')
.pipe(concat('components.js'))
.pipe(gulp.dest('./public/js/'))
.pipe(gulp.dest('./docs/js/'));
});
gulp.task('js:libs', () => {
gulp.src('./node_modules/tiny-slider/dist/min/tiny-slider.js')
.pipe(concat('libs.js'))
.pipe(gulp.dest('./public/js/'))
.pipe(gulp.dest('./docs/js/'));
});
gulp.task('css:libs', () => {
gulp.src('./node_modules/tiny-slider/dist/tiny-slider.css')
.pipe(concat('libs.css'))
.pipe(gulp.dest('./public/css/'))
.pipe(gulp.dest('./docs/css/'));
});
gulp.task('scss', () => {
gulp.src('./src/index.scss')
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
.pipe(autoprefixer({browsers: ['last 10 versions'], cascade: false}))
.pipe(gulp.dest('./public/css/'))
.pipe(gulp.dest('./docs/css/'));
});
gulp.task('html', () => {
gulp.src('./src/*.html')
.pipe(gulp.dest('./public/'))
.pipe(gulp.dest('./docs/'));
});
gulp.task('manifest', () => {
gulp.src('./src/manifest.json')
.pipe(gulp.dest('./public/'))
.pipe(gulp.dest('./docs/'));
});
gulp.task('serviceworker', () => {
gulp.src('./src/service-worker.js')
.pipe(gulp.dest('./public/'))
.pipe(gulp.dest('./docs/'));
});
gulp.task('img', () => {
gulp.src('./src/img/*.*')
.pipe(imgMin())
.pipe(gulp.dest('./public/img/'))
.pipe(gulp.dest('./docs/img/'));
});
gulp.task('default', ['css:libs', 'scss', 'js:libs', 'js', 'img', 'html', 'manifest', 'serviceworker'], () => {
browserSync.init({server: "./public/"});
gulp.watch("./src/**/*.js", ['js']);
gulp.watch("./src/**/*.scss", ['scss']);
gulp.watch("./src/*.html", ['html']);
gulp.watch("./src/img/*.*", ['img']);
gulp.watch("./public/**/*.*").on('change', browserSync.reload);
});