-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
79 lines (61 loc) · 1.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
"use strict";
var gulp = require("gulp");
var sass = require("gulp-sass");
var browserify = require("browserify");
var source = require("vinyl-source-stream");
var uglify = require("gulp-uglify");
var uglifyCss = require("gulp-uglifycss");
//var streamify = require("gulp-streamify");
var rename = require("gulp-rename");
var processhtml = require("gulp-processhtml");
var gls = require("gulp-live-server");
///Process Sass files..
gulp.task("sass", function() {
var _SourceFile = "./Sass/Main.scss";
gulp.src(_SourceFile)
.pipe(sass().on("error", sass.logError))
.pipe(gulp.dest("./Dev"));
});
gulp.task("mini-css", function() {
var _SourceFile = "./Dev/Main.css";
gulp.src(_SourceFile)
.pipe(uglifyCss())
.pipe(rename({
basename : "Main",
extname : ".min.css"
}))
.pipe(gulp.dest("./Build"));
});
///Process JS files..
gulp.task("js", function() {
var _SourceFile = "./Scripts/MainPage.js";
return browserify(_SourceFile)
.bundle()
.pipe(source("Main.js"))
.pipe(gulp.dest("./Dev"));
});
gulp.task("mini-js",function () {
var _Source = "./Dev/Main.js";
gulp.src(_Source)
.pipe(uglify())
.pipe(rename({
basename : "Main",
extname : ".min.js"
}))
.pipe(gulp.dest("./Build"));
});
gulp.task("html", function() {
var _SourceFile = "./Dev/index.html";
gulp.src(_SourceFile)
.pipe(processhtml())
.pipe(gulp.dest("."));
});
gulp.task("server", function() {
var server = gls.static("./Dev", 8888);
server.start();
var watcher = gulp.watch(["./Sass/*.scss", "./Scripts/*.js" , "./Dev/index.html"],["sass" , "js"]);
watcher.on("change", function(file) {
server.notify.apply(server, [file]);
});
});
gulp.task("build", ["sass", "js", "mini-css", "mini-js" , "html"]);