-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
65 lines (55 loc) · 1.45 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
"use strict";
const gulp = require('gulp');
const less = require('gulp-less');
const shell = require('gulp-shell');
const autoprefixer = require('gulp-autoprefixer');
const browserSync = require('browser-sync');
const reload = browserSync.reload;
const paths = {
build: {
watch: 'src/tyxml_translator_web.ml',
html: 'static/index.html'
},
less: {
src: 'src/less/style.less',
dest: 'static/',
watch: 'src/less/**'
}
};
gulp.task('build', shell.task([
'make static/tyxml_translator_web.js'
]));
gulp.task('less', function () {
gulp.src(paths.less.src)
.pipe(less())
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(gulp.dest(paths.less.dest))
.pipe(reload({stream:true}));
});
gulp.task('browser-sync', function() {
browserSync({
server: {
baseDir: "static",
directory: true
},
open: false
});
});
gulp.task('bs-reload', function () {
browserSync.reload();
});
gulp.task('build-watch', ['build'], function() {
browserSync.reload();
});
gulp.task('html-watch', function() {
browserSync.reload();
});
gulp.task('watch', ['build', 'less', 'browser-sync'], function () {
gulp.watch(paths.less.watch, ['less']);
gulp.watch(paths.build.watch, ['build-watch']);
gulp.watch(paths.build.html, ['html-watch']);
});
gulp.task('default', ['less', 'build']);