-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
81 lines (67 loc) · 2.47 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
/*
This file in the main entry point for defining Gulp tasks and using Gulp plugins.
Click here to learn more. http://go.microsoft.com/fwlink/?LinkId=518007
*/
var gulp = require("gulp");
var ts = require("gulp-typescript");
var imagemin = require("gulp-imagemin");
var filter = require("gulp-filter");
var newer = require("gulp-newer");
var uglify = require("gulp-uglify");
var pump = require("pump");
var stripBom = require("gulp-stripbom");
//"compress",
gulp.task("default", ["copyBootstrapFiles", "copyLightboxFiles", "buildTypescript"], function () {
// place code for your default task here
});
gulp.task("all", ["copyBootstrapFiles", "copyLightboxFiles", "buildTypescript", "images", "removeBom"], function () {
// place code for your default task here
});
gulp.task("copyBootstrapFiles", function () {
gulp.src("./node_modules/bootstrap-sass/assets/fonts/bootstrap/*.*")
.pipe(gulp.dest("./fonts/bootstrap"));
return gulp.src("./node_modules/bootstrap-sass/assets/stylesheets/**/*.*")
.pipe(gulp.dest("./_sass/bootstrap"));
});
gulp.task("copyLightboxFiles", function () {
gulp.src(["./node_modules/lightbox2/dist/js/lightbox.min.js", "./node_modules/lightbox2/dist/js/lightbox.min.map"])
.pipe(gulp.dest("./scripts"));
gulp.src("./node_modules/lightbox2/dist/css/*.min.css")
.pipe(gulp.dest("./css"));
return gulp.src("./node_modules/lightbox2/dist/images/*.*")
.pipe(gulp.dest("./images"));
});
gulp.task("buildTypescript", function () {
return gulp.src("typescript/*.ts")
.pipe(ts({
noImplicitAny: true,
out: "software-architects-website.js"
}))
.pipe(gulp.dest("scripts"));
});
//Compress all images
gulp.task("images", function () {
var allFilter = filter(["**/*.jpeg", "**/*.gif", "**/*.jpg", "**/*.png"], { restore: true });
return gulp.src("content/imagesOriginal/**/*")
.pipe(newer("content/images"))
.pipe(allFilter)
.pipe(imagemin())
.pipe(allFilter.restore)
.pipe(gulp.dest("content/images"))
});
//Compress all javascript files
gulp.task("compress", function (cb) {
pump([
gulp.src("scripts/**/*"),
uglify(),
gulp.dest("scripts")
],
cb
);
});
//Remove the byte order mark from all files
gulp.task("removeBom", function () {
return gulp.src("**!(.sln)/*!(.sln)")
.pipe(stripBom())
.pipe(gulp.dest("."));
});