-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
47 lines (37 loc) · 1.26 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
const path = require('path');
const gulp = require('gulp');
const sass = require('gulp-sass');
const livereload = require('gulp-livereload');
const webserver = require('gulp-webserver');
const clean = require('gulp-clean');
const sassMatch = 'src/sass/**/*.sass';
const htmlMatch = 'src/index.html';
const jsMatch = 'src/js/*.js';
const outBase = 'dist';
const copy = (match, outDir) => {
gulp.src(match)
.pipe(gulp.dest(outDir));
};
gulp.task('sass', () => {
gulp.src(sassMatch)
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest(path.join(outBase, 'css')));
});
gulp.task('html', () => copy(htmlMatch, outBase));
gulp.task('js', () => copy(jsMatch, path.join(outBase, 'js')));
gulp.task('setup', () => copy('src/index.theme', outBase));
gulp.task('static', () => copy('src/static/**/*', outBase));
gulp.task('serve', () => {
gulp.src(outBase)
.pipe(webserver({ livereload: true }));
});
gulp.task('dev', () => {
gulp.start('build');
gulp.watch('src/index.theme', ['setup']);
gulp.watch(sassMatch, ['sass']);
gulp.watch(htmlMatch, ['html']);
gulp.watch(jsMatch, ['js']);
gulp.watch('src/static', ['static']);
gulp.start('serve');
});
gulp.task('build', ['setup', 'sass', 'html', 'js', 'static']);