-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
50 lines (44 loc) · 1.43 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
const gulp = require('gulp');
const run = require('gulp-run');
const pug = require('gulp-pug');
const sass = require('gulp-sass');
const ts = require("gulp-typescript");
const uglify = require('gulp-uglify');
const sourcemaps = require('gulp-sourcemaps');
const autoprefixer = require('gulp-autoprefixer');
const tsProject = ts.createProject("tsconfig.json");
const browserSync = require('browser-sync').create();
gulp.task('go', ['compile'], function() {
browserSync.init({
server: 'dist',
notify: false,
ui: false
});
gulp.watch('src/sass/main.sass', ['sass']);
gulp.watch('src/pug/index.pug', ['pug']);
gulp.watch('src/typescript/*.ts', ['ts']);
gulp.watch(['dist/js/*.js', 'dist/index.html']).on('change', browserSync.reload);
});
gulp.task('sass', function(){
return gulp.src('src/sass/main.sass')
.pipe(sass({
outputStyle: 'compressed',
indentedSyntax: true
}))
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(gulp.dest('dist/css'))
.pipe(browserSync.stream());
});
gulp.task('ts', function() {
return run('webpack --progress --config=./webpack.config.js').exec();
});
gulp.task('pug', function buildHTML() {
return gulp.src('src/pug/index.pug')
.pipe(pug())
.pipe(gulp.dest('dist/'));
});
gulp.task('compile', ['sass', 'ts', 'pug']);
gulp.task('default', ['go']);