-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
52 lines (44 loc) · 1.53 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
var gulp = require("gulp"),
browserify = require("browserify"),
reactify = require("reactify"),
source = require("vinyl-source-stream"),
buffer = require("vinyl-buffer"),
sass = require("gulp-sass"),
sourcemaps = require("gulp-sourcemaps"),
rename = require("gulp-rename");
// Tasks for each Gasch component
// ------------------------------
var components = ["browser", "editor"];
components.map(function(component) {
gulp.task(component+"-static", function() {
return gulp.src("./"+component+"/static/*")
.pipe(gulp.dest("./public/"+component));
});
gulp.task(component+"-scripts", function() {
return browserify("./"+component+"/js/index.js", {
debug: true
})
.bundle()
.pipe(source(component+".js"))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(sourcemaps.write())
.pipe(gulp.dest("./public/js/"));
});
gulp.task(component+"-sass", function() {
return gulp.src("./"+component+"/scss/index.scss")
.pipe(sass().on('error', sass.logError))
.pipe(rename(component+".css"))
.pipe(gulp.dest("./public/css"));
});
gulp.task(component, [component+"-static", component+"-scripts",
component+"-sass"]);
});
gulp.task("watch", function() {
components.map(function(component) {
gulp.watch("./"+component+"/static/*", [component+"-static"]);
gulp.watch("./"+component+"/js/*", [component+"-scripts"]);
gulp.watch("./"+component+"/scss/*", [component+"-sass"]);
});
});
gulp.task("default", components);