-
Notifications
You must be signed in to change notification settings - Fork 11
/
gulpfile.js
72 lines (62 loc) · 1.56 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
67
68
69
70
71
72
'use strict';
const gulp = require('gulp'),
$ = require('gulp-load-plugins')(),
path = require('path'),
release = $.util.env.release || '0.7.1';
$.del = require('del');
$.request = require('superagent');
$.Q = require('q');
const data = {release};
data.releaseLink = 'https://github.com/Laverna/laverna/releases/download/';
data.downLink = `${data.releaseLink}${release}/laverna-${release}-`;
// Load and create tasks
['copy', 'font', 'template'].forEach(name => {
require(`./gulp/${name}`)(gulp, $, data);
});
// Livereload server.
gulp.task('default', ['sass', 'template'], () => {
$.connect.server({
livereload : true,
root : 'app',
});
gulp.watch('app/templates/*.html', ['template']);
gulp.watch('app/styles/*.scss', ['sass']);
});
/**
* Build.
* Example:
* `gulp build --release 0.7.1`
*/
gulp.task('build', $.sequence(
'clean',
'template',
'sass',
[
'copy:css',
'copy:html',
'copy:assets',
],
[
'fontspider',
'fontmin',
'image',
]
));
gulp.task('clean', () => {
return $.del(['dist/**/*']);
});
gulp.task('sass', () => {
return gulp.src('./app/styles/main.scss')
.pipe($.sass({
includePaths: [
path.join(__dirname, './node_modules/'),
],
}).on('error', $.sass.logError))
.pipe(gulp.dest('./app/styles'))
.pipe($.connect.reload());
});
gulp.task('image', () => {
return gulp.src('./dist/images/**/*')
.pipe($.image())
.pipe(gulp.dest('./dist/images'));
});