-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
62 lines (51 loc) · 1.55 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
'use strict';
var gulp = require('gulp'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
tinypng = require('gulp-tinypng-compress'),
browserSync = require('browser-sync').create();
sass.compiler = require('node-sass');
const { watch } = require('gulp');
gulp.task('browser-sync', function(cb) {
browserSync.init({
server: {
baseDir: "./docs"
}
});
browserSync.watch('docs/').on('change', browserSync.reload);
cb();
});
gulp.task('sass', function(cb) {
gulp.src('docs/scss/**/*.scss')
.pipe(sass({
outputStyle: 'expanded',
}).on('error', sass.logError))
.pipe(autoprefixer(
['Last 30 versions']
))
.pipe(gulp.dest('docs/css'))
.pipe(browserSync.reload({stream: true}));
cb();
});
gulp.task('tinypng', function () {
return gulp.src('docs/img/**/*.{png,jpg,jpeg}')
.pipe(tinypng({
key: 'CMX7yWxk1lc5Fp9nMWGlRX7pMBGrwGsc',
sigFile: 'docs/img/.tinypng-sigs',
log: true
}))
.pipe(gulp.dest('img'));
});
gulp.task('scripts', function () {
return gulp.src('src/**/*.ts')
.pipe(ts({
noImplicitAny: true,
outFile: 'output.js'
}))
.pipe(gulp.dest('docs/js'));
});
gulp.task('default', function() {
gulp.watch('docs/**/*.html', gulp.series('browser-sync'));
gulp.watch('docs/**/*.scss', gulp.series('sass','browser-sync'));
gulp.watch('docs/img/**/*.{png,jpg,jpeg}', gulp.series('tinypng'));
});