-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
66 lines (54 loc) · 1.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
"use strict";
var gulp = require("gulp");
var plugins = require("gulp-load-plugins")();
var browserSync = require("browser-sync");
var glob = {
styles: [
"bower_components/normalize.css/normalize.css",
"blocks/*/**.css"
],
riot: [
"blocks/*/**.tag"
],
html: [
"pages/*.html"
],
postcss: [
require("postcss-simple-vars")({ variables: require("./postcss/vars/colors") }),
require("autoprefixer-core")
]
};
gulp.task("styles", function() {
return gulp.src(glob.styles)
.pipe(plugins.plumber())
.pipe(plugins.postcss(glob.postcss))
.pipe(plugins.concat("style.css"))
.pipe(gulp.dest("build/"))
.pipe(browserSync.reload({stream: true}));
});
gulp.task("scripts", function() {
return gulp.src(glob.riot)
.pipe(plugins.plumber())
.pipe(plugins.riot())
.pipe(plugins.addSrc.prepend(["bower_components/riot/riot.js"]))
.pipe(plugins.concat("script.js"))
.pipe(plugins.header("var data = " + JSON.stringify(require("../data/listing.json")) + ";\n\n"))
.pipe(gulp.dest("build/"))
.pipe(browserSync.reload({stream: true}));
});
gulp.task("browser-sync", ["styles", "scripts"], function() {
browserSync({
server: {
baseDir: "./"
}
});
});
gulp.task("watch", ["browser-sync"], function () {
plugins.watch(glob.html, browserSync.reload);
plugins.watch(glob.styles, function(vinyl) {
gulp.start("styles");
});
plugins.watch(glob.riot, function(){
gulp.start("scripts");
});
});