This repository has been archived by the owner on Jan 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
128 lines (104 loc) · 2.83 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*jshint node: true */
var gulp = require("gulp"),
gutil = require("gulp-util"),
jade = require("gulp-jade"),
jscs = require("gulp-jscs"),
stylishJscs = require("gulp-jscs-stylish"),
jshint = require("gulp-jshint"),
plumber = require("gulp-plumber"),
rename = require("gulp-rename"),
rimraf = require("gulp-rimraf"),
shell = require("gulp-shell"),
stylus = require("gulp-stylus"),
uglify = require("gulp-uglify"),
stylishJshint = require("jshint-stylish"),
bower = require("gulp-bower"),
_ = require("underscore");
(function () {
"use strict";
var gulpSrc = gulp.src;
gulp.src = function () {
return gulpSrc.apply(gulp, arguments)
.pipe(plumber(function (error) {
gutil.log(gutil.colors.red("Error (" + error.plugin + "): " + error.message));
this.emit("end");
}));
};
}());
gulp.task("jade", function () {
"use strict";
return gulp.src("src/jade/*.jade")
.pipe(jade())
.pipe(gulp.dest("./build/site"));
});
gulp.task("stylus", function () {
"use strict";
return gulp.src("src/styl/**/*.styl")
.pipe(stylus({
compress: true
}))
.pipe(gulp.dest("./build/site"));
});
gulp.task("uglify", function () {
"use strict";
var dest = _.bind(gulp.dest, gulp, "build/site");
return gulp.src("src/js/index.js")
.pipe(dest())
.pipe(uglify())
.pipe(rename("index.min.js"))
.pipe(dest());
});
gulp.task("lint", function () {
"use strict";
return gulp.src([
"src/js/**/*.js",
"gulpfile.js"
])
.pipe(jshint())
.pipe(jshint.reporter(stylishJshint))
.pipe(jshint.reporter("fail"));
});
gulp.task("style", function () {
"use strict";
return gulp.src([
"src/js/**/*.js",
"gulpfile.js"
])
.pipe(jscs())
.pipe(stylishJscs());
});
gulp.task("assets", function () {
"use strict";
gulp.src("src/assets/**/*")
.pipe(gulp.dest("./build/site/assets"));
});
gulp.task("clean", function () {
"use strict";
return gulp.src("./build/**", { read: false })
.pipe(rimraf());
});
gulp.task("bower", function () {
"use strict";
return bower()
.pipe(gulp.dest("./build/site/bower_components"));
});
gulp.task("default", [
"lint",
"style",
"stylus",
"uglify",
"jade",
"assets",
"bower"
]);
gulp.task("serve", function () {
"use strict";
var host = process.env.CLIQUE_HOST || "localhost",
port = process.env.CLIQUE_PORT || 3000;
return gulp.src("")
.pipe(shell(["tangelo",
"--host", host,
"--port", port,
"--root", "build/site",
"--config", "tangelo-config.yaml"].join(" ")));
});