-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
80 lines (62 loc) · 1.96 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
74
75
76
77
78
79
80
var gulp = require("gulp"),
sass = require("gulp-sass"),
path = require("path"),
del = require("del"),
zip = require("gulp-zip"),
karma = require('gulp-karma'),
sourcemaps = require('gulp-sourcemaps'),
runSequence = require('run-sequence');
var userModule = "./web/app/user";
var testRoot = "./web/test";
var testFiles = testRoot + "/unit/**/*.js";
// SASS Related tasks
gulp.task("sass:compile", function () {
var outputStyle = "expanded"; // "nested" | "compact" | "compressed" | "expanded"
return gulp.src(
path.join(userModule, "/sass/ajabShahar.scss")
)
.pipe(sourcemaps.init())
.pipe(sass({outputStyle: outputStyle}))
.pipe(sourcemaps.write())
.pipe(gulp.dest(
path.join(userModule, "/css")
));
});
gulp.task("sass:watch", function () {
gulp.watch(
path.join(userModule, "/sass/ajabShahar.scss"),
["sass:compile"]
);
// gutil.log("[watch:sass]", gutil.colors.yellow("Watching SASS files..."));
});
// Common tasks
gulp.task("watch", ["sass:watch"]);
gulp.task("sass", ["sass:compile"]);
gulp.task('js', function () {
return gulp.src('web/**/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(gulp.dest('dist'));
});
gulp.task("clean", function () {
del(['dist/*']);
});
gulp.task("test", ["sass:compile"], function () {
return gulp.src("/blah") // there is a bug in gulp-karma which requires a wrong file path to work!
.pipe(karma({
configFile: testRoot + '/config/karma.conf.js',
action: "run"
}))
.on('error', function (err) {
console.log(err);
throw err;
});
});
gulp.task("zip", ["clean", "sass:compile"], function () {
return gulp.src('web/app/**')
.pipe(zip('ajabshahar.zip'))
.pipe(gulp.dest('dist'))
});
gulp.task("default", function (callback) {
runSequence('test', 'zip')
});