forked from ituk-ttu/liitu.ituk.ee
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
83 lines (76 loc) · 2.23 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
var gulp = require("gulp");
var jade = require("gulp-jade");
var less = require("gulp-less");
var plumber = require("gulp-plumber");
var sourcemaps = require("gulp-sourcemaps");
var uglify = require("gulp-uglify");
var concat = require("gulp-concat");
var watch = require("gulp-watch");
var es = require('event-stream');
//var jslint = require("gulp-jslint");
//var recess = require("gulp-recess");
var dir = {
assets: "assets/",
src: "src/",
dest: "build/",
bower: "bower_components/"
};
gulp.task("js", function() {
es.concat(
gulp.src(dir.src + dir.assets + "js/**/*.js")
)
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(concat("app.js"))
//.pipe(uglify())
.pipe(sourcemaps.write())
.pipe(gulp.dest(dir.dest + dir.assets + "js/"));
});
gulp.task("jade", function () {
var locations = [
{
src: "*.jade",
dest: ""
},
{
src: "templates/**/*jade",
dest: "templates/"
}
];
for(var i = 0; i < locations.length; i++) {
gulp.src(dir.src + locations[i].src)
.pipe(plumber())
.pipe(jade({
pretty: true,
doctype: "HTML"
}))
.pipe(gulp.dest(dir.dest + locations[i].dest));
}
});
gulp.task("less", function() {
gulp.src(dir.src + dir.assets + "less/master.less")
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(less())
.pipe(sourcemaps.write())
.pipe(gulp.dest(dir.dest + dir.assets + "css/"));
});
gulp.task("img", function () {
gulp.src(dir.src + dir.assets + 'img/**/*.{jpg,png,svg}')
.pipe(gulp.dest(dir.dest + dir.assets + 'img/'))
});
gulp.task("compile", ["jade", "js", "less", "img"]);
gulp.task("default", ["jade", "js", "less", "img"], function() {
gulp.watch(dir.src + dir.assets + "js/**/*.js", function() {
gulp.run("js");
});
gulp.watch(dir.src + dir.assets + "less/**/*.less", function() {
gulp.run("less");
});
gulp.watch(dir.src + "/**/*.jade", function() {
gulp.run("jade");
});
gulp.watch(dir.src + dir.assets + "img/**/*.{jpg,png,svg}", function() {
gulp.run("img");
});
});