-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
81 lines (70 loc) · 2.09 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
var gulp = require("gulp"),
sass = require("gulp-sass"),
minifycss = require("gulp-minify-css"),
rename = require("gulp-rename"),
autoprefixer = require("gulp-autoprefixer"),
uglify = require("gulp-uglify"),
concat = require("gulp-concat"),
plumber = require("gulp-plumber"),
notify = require("gulp-notify"),
connect = require("gulp-connect-php");
var onError = notify.onError({
title: "Your SASS is broken!",
subtitle: "<%= file %> did not compile!",
message: "<%= error.message %>"
});
function compileSass (name, pathToSass) {
gulp.src(pathToSass + "/" + name + ".sass")
// .pipe(plumber({
// errorHandler: onError
// }))
.pipe(sass({
loadPath: process.cwd() + pathToSass,
style: "nested",
indentedSyntax: true
}))
.pipe(autoprefixer({
browsers: ["last 20 versions", "> 1%"],
cascade: false
}))
.pipe(gulp.dest("assets/css"))
.pipe(rename({suffix: ".min"}))
.pipe(minifycss())
.pipe(gulp.dest("assets/css"))
.pipe(notify(name + " successfully compiled!"));
}
gulp.task("start-php", function() {
connect.server({
port: 8001
});
});
gulp.task("alerts", function () {
compileSass("alerts", "assets/css/_inc/alerts")
});
gulp.task("common", function () {
compileSass("common", "assets/css/_inc/common")
});
gulp.task("forms", function () {
compileSass("forms", "assets/css/_inc/forms")
});
gulp.task("labels", function () {
compileSass("labels", "assets/css/_inc/labels")
});
gulp.task("litchi", function () {
compileSass("litchi", "assets/css/_inc")
});
gulp.task("uglify", function () {
gulp.src("assets/js/include/*.js")
.pipe(concat("litchi.js"))
.pipe(uglify("litchi.js"))
.pipe(gulp.dest("assets/js"))
.pipe(notify("JavaScript successfully compiled!"));
});
gulp.task("default", ["start-php"], function () {
gulp.watch("assets/css/_inc/alerts/**/*.sass", ["alerts"]);
gulp.watch("assets/css/_inc/common/**/*.sass", ["common"]);
gulp.watch("assets/css/_inc/forms/**/*.sass", ["forms"]);
gulp.watch("assets/css/_inc/labels/**/*.sass", ["labels"]);
gulp.watch("assets/css/_inc/**/*.sass", ["litchi"]);
gulp.watch("assets/js/include/*.js", ["uglify"]);
});