-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
70 lines (61 loc) · 1.69 KB
/
gulpfile.js
File metadata and controls
70 lines (61 loc) · 1.69 KB
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
// Various helper modules
const gulp = require("gulp");
const plug = require("gulp-load-plugins")();
const babel = require('gulp-babel');
const less = require('gulp-less');
const path = require('path');
var notify = require('gulp-notify');
var source = [
'app/**/*.js',
"!app/vendor/**/*.*",
"!app/**/*.spec.js"
];
gulp.task('webserver', function() {
return gulp
.src('build') // root
.pipe(plug.webserver({
livereload: true, // livereload
directoryListing: true,
open: "http://localhost:8000/index.html#/search" // index.html
}));
});
gulp.task("hint", function() {
return gulp
.src(source)
.pipe(plug.jshint("./.jshintrc"))
.pipe(plug.jshint.reporter("jshint-stylish"));
});
gulp.task("watch", function() {
gulp
.watch(source, ["hint"])
.on("change", function(event) {
console.log("*** File " + event.path + " was " + event.type + ", running tasks...");
});
gulp.watch('app/**/*.js', ['babel']);
gulp.watch('app/**/*.{html,json,img}', ['not-compiled']);
gulp.watch('app/style/**/*.less', ['less']);
});
gulp.task("babel", function() {
return gulp
.src('app/**/*.js')
.pipe(babel({
presets: ['es2015']
}))
.pipe(gulp.dest('build'));
});
gulp.task("not-compiled", function() {
return gulp
.src(['app/**/*.{html,json,png,gif,jpg}'])
.pipe(gulp.dest('build'));
});
gulp.task('less', function () {
return gulp.src('app/style/*.less')
.pipe(less({
paths: [ path.join(__dirname, 'less', 'includes') ]
}).on("error", notify.onError(function (error) {
return "Error: " + error.message;
})))
.pipe(gulp.dest('build/style'));
});
gulp.task("build", ["babel", "not-compiled", 'less']);
gulp.task("start", ['build', 'watch', "webserver"]);