-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
executable file
·53 lines (42 loc) · 1.42 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
var gulp = require('gulp');
var appDev = 'dev/';
var appProd = 'prod/';
/* Mixed */
var ext_replace = require('gulp-ext-replace');
/* CSS */
var postcss = require('gulp-postcss');
var sourcemaps = require('gulp-sourcemaps');
var autoprefixer = require('autoprefixer');
var precss = require('precss');
var cssnano = require('cssnano');
/* JS & TS */
var jsuglify = require('gulp-uglify');
var typescript = require('gulp-typescript');
/* Images */
var imagemin = require('gulp-imagemin');
var tsProject = typescript.createProject('tsconfig.json');
gulp.task('build-css', function () {
return gulp.src(appDev + '**/**/*.scss')
.pipe(sourcemaps.init())
.pipe(postcss([precss, autoprefixer, cssnano]))
.pipe(sourcemaps.write())
.pipe(ext_replace('.css'))
.pipe(gulp.dest(appProd));
});
gulp.task('build-ts', function () {
return gulp.src(appDev + '**/**/*.ts')
.pipe(sourcemaps.init())
.pipe(typescript(tsProject))
.pipe(sourcemaps.write())
.pipe(gulp.dest(appProd));
});
gulp.task('build-html', function () {
return gulp.src(appDev + '**/**/*.html')
.pipe(gulp.dest(appProd));
});
gulp.task('watch', function () {
gulp.watch(appDev + '**/**/*.ts', ['build-ts']);
gulp.watch(appDev + '**/**/*.scss', ['build-css']);
gulp.watch(appDev + '**/**/*.html', ['build-html']);
});
gulp.task('default', ['watch', 'build-ts', 'build-html', 'build-css']);