-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
69 lines (58 loc) · 1.91 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
(function () {
"use strict";
var gulp = require('gulp'),
sass = require('gulp-sass'),
minifyCss = require('gulp-minify-css'),
uglify = require('gulp-uglify'),
exec = require('child_process').exec,
sourcemaps = require('gulp-sourcemaps'),
del = require('del');
gulp.task('styles', ['bower', 'apm'], function () {
return gulp.src('src/scss/style.scss')
.pipe(sass())
.pipe(minifyCss())
.pipe(gulp.dest('app/css'));
});
gulp.task('scripts', function () {
return gulp.src('src/js/**/*.js')
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('app/js'));
});
gulp.task('html', function () {
return gulp.src('src/html/**/*.html')
.pipe(gulp.dest('app'));
});
gulp.task('bower', function (cb) {
exec('cd app && bower install', function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
});
gulp.task('clean', function (cb) {
del(['build/**/*'], cb);
});
gulp.task('apm', function (cb) {
exec('cd app && apm install .', function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
});
gulp.task('compile', ['styles', 'scripts', 'html']);
gulp.task('watch', ['compile'], function () {
gulp.watch('src/scss/**/*.scss', ['styles']);
gulp.watch('src/js/**/*.js', ['scripts']);
gulp.watch('src/html/**/*.html', ['html']);
});
gulp.task('build', ['compile', 'clean'], function (cb) {
exec('grunt', function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
});
gulp.task('default', ['build']);
}());