-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gulpfile.js
51 lines (42 loc) · 1.21 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
(function () {
'use strict';
})();
var gulp = require('gulp'),
sass = require('gulp-sass'),
sourcemaps = require('gulp-sourcemaps'),
concat = require('gulp-concat'),
csso = require('gulp-csso'),
uglify = require('gulp-uglify'),
pump = require('pump'),
rename = require('gulp-rename');
gulp.task('sass', function () {
return gulp.src('./scss/**/*.scss')
.pipe(sourcemaps.init())
.pipe(sass())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./css'));
});
gulp.task('concat', function () {
return gulp.src(['./js/web-app.js', 'node_modules/chart.js/dist/Chart.js', './js/scripts.js'])
.pipe(sourcemaps.init())
.pipe(concat('app.js'))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./js'));
});
gulp.task('uglify', ['concat'], function () {
return gulp.src('./js/app.js')
.pipe(uglify())
.pipe(rename('app.min.js'))
.pipe(gulp.dest('./js'));
});
gulp.task('crunch', ['sass'], function () {
return gulp.src('./css/app.css')
.pipe(csso())
.pipe(rename('app.min.css'))
.pipe(gulp.dest('./css'));
});
gulp.task("watchFiles", function(){
gulp.watch("./scss/**/*.scss", ["crunch"]);
gulp.watch("./js/**/*.js", ["uglify"]);
});
gulp.task('serve', ['watchFiles']);