-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
73 lines (62 loc) · 1.87 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
70
71
72
73
var gulp = require('gulp');
var del = require('del');
var babel = require('gulp-babel');
var jade = require('gulp-jade');
var jshint = require('gulp-jshint');
var mocha = require('gulp-mocha');
var sass = require('gulp-sass');
var packageJson = require('./package.json');
gulp.task('clean', function (cb) {
del(['./build/**/*'], cb);
});
gulp.task('copy-lib', function () {
return gulp.src([
'./node_modules/normalize.css/normalize.css',
'./lib/**'
]).pipe(gulp.dest('./build/lib'));
});
gulp.task('copy-assets', function () {
return gulp.src('./src/assets/**/*')
.pipe(gulp.dest('./build/assets'));
});
gulp.task('babel', function () {
return gulp.src('./src/js/*.js')
.pipe(babel())
.pipe(gulp.dest('./build/js'));
});
gulp.task('jade', function () {
return gulp.src('./src/*.jade')
.pipe(jade({
pretty: true,
locals: {
VERSION_NUMBER: packageJson.version,
}
}))
.pipe(gulp.dest('./build'));
});
gulp.task('jshint', function () {
gulp.src('./src/js/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('sass', function () {
gulp.src('./src/css/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./build/css'));
});
gulp.task('babel-test', function () {
var stream = gulp.src('./src/test/*.js')
.pipe(babel())
.pipe(gulp.dest('./build/test'));
return stream;
});
gulp.task('test', ['babel', 'babel-test'], function () {
return gulp.src('./build/test/*.js')
.pipe(mocha({reporter: 'spec'}));
});
gulp.task('build-prod', ['copy-lib', 'copy-assets', 'babel', 'jade', 'sass']);
gulp.task('default', ['copy-lib', 'copy-assets', 'babel', 'jade', 'sass'], function () {
gulp.watch('./src/**/*.js', ['babel', 'test']);
gulp.watch('./src/**/*.scss', ['sass']);
gulp.watch(['./src/**/*.jade', './src/**/*.html'], ['jade']);
});