-
Notifications
You must be signed in to change notification settings - Fork 23
/
gulpfile.js
107 lines (91 loc) · 2.57 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
// --- bootstrap.offcanvas gulpfile
var gulp = require('gulp'),
less = require('gulp-less'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
markdown = require('gulp-markdown'),
through2 = require('through2'),
fs = require('fs')
;
gulp.task("build", ['less', 'less.min', 'js', 'js.min', 'example']);
gulp.task('example', function() {
gulp.src([
"./dist/js/drawer.js",
"./bower_components/bootstrap/dist/css/bootstrap.min.css",
"./bower_components/bootstrap/dist/js/bootstrap.min.js"
])
.pipe(gulp.dest("./example"))
;
});
gulp.task("less", function() {
gulp.src("./less/bootstrap-drawer.less")
.pipe(less({
paths: ["./less"]
}))
.pipe(gulp.dest("./example"))
;
gulp.src("./less/bootstrap-drawer.less")
.pipe(less({
paths: ["./less"],
debug: true
}))
.pipe(gulp.dest("./dist/css"))
;
});
gulp.task("less.min", function() {
gulp.src("./less/bootstrap-drawer.less")
.pipe(less({
paths: ["./less"],
compress: true
}))
.pipe(rename("bootstrap-drawer.min.css"))
.pipe(gulp.dest("./dist/css"))
;
});
gulp.task('js', function() {
gulp.src("./js/*.js")
.pipe(gulp.dest("./dist/js"))
;
gulp.src("./js/*.js")
.pipe(gulp.dest("./example"))
;
});
gulp.task('js.min', function() {
gulp.src("./js/*.js")
.pipe(uglify())
.pipe(rename({extname: ".min.js"}))
.pipe(gulp.dest("./dist/js"))
;
});
gulp.task('docs.less', function() {
gulp.src("./less/drawer-docs.less")
.pipe(less({compress: true}))
.pipe(gulp.dest("./example"))
;
});
gulp.task('docs.md', function() {
gulp.src("./docs/*.md")
.pipe(markdown())
.pipe(gulp.dest("./docs/html"))
});
gulp.task('docs', ['docs.less', 'docs.md'], function() {
var header = fs.readFileSync("./docs/_header.htm")
, footer = fs.readFileSync("./docs/_footer.htm")
;
gulp.src("./docs/html/*.html")
.pipe(through2.obj(function(file, enc, cb){
if (file.isNull()) {
// return empty file
cb(null);
}
if (file.isStream()) {
return callback(new gutil.PluginError(PLUGIN_NAME, 'No stream support.'));
}
file.contents = Buffer.concat([
header, file.contents, footer
]);
cb(null, file);
}))
.pipe(gulp.dest("./"))
;
});