-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgulpfile.js
73 lines (61 loc) · 1.84 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
73
const del = require('delete');
const gulp = require('gulp');
const livereload = require('gulp-livereload');
const markdown = require('gulp-markdown');
const mustache = require('gulp-mustache');
const rename = require('gulp-rename');
const sourcemaps = require('gulp-sourcemaps');
const webserver = require('gulp-webserver');
const runSequence = require('run-sequence');
const DATA = require('./data');
gulp.task('styles', function () {
return gulp.src('./src/styles/main.css')
.pipe(sourcemaps.write({ sourceRoot: 'src/styles' }))
.pipe(gulp.dest('./dist/styles'))
.pipe(livereload());
});
gulp.task('compile-mustache', function () {
return gulp.src('./src/template/index.mustache')
.pipe(mustache({
title: DATA.title,
xpi: DATA.xpi
}, { extension: '.html' }))
.pipe(gulp.dest('./dist'))
.pipe(livereload());
});
gulp.task('rename', function () {
gulp.src('./compile/copy.html')
.pipe(rename('./compile/copy.mustache'))
.pipe(gulp.dest('./'));
});
gulp.task('markdown', function () {
return gulp.src('copy.md')
.pipe(markdown())
.pipe(gulp.dest('./compile'));
});
gulp.task('move:images', function () {
gulp.src('./src/images/**')
.pipe(gulp.dest('./dist/images'));
});
gulp.task('compile-markdown', ['markdown', 'rename']);
gulp.task('build', function () {
runSequence('compile-markdown',
'move:images',
'styles',
'compile-mustache');
});
gulp.task('server', function () {
gulp.src('./dist')
.pipe(webserver({
directoryListing: false
}));
});
gulp.task('delete', function () {
del(['./compile']);
});
gulp.task('default', ['build', 'server'], function () {
livereload.listen();
gulp.watch('./src/styles/**/*.css', ['styles']);
gulp.watch('./src/**/*.mustache', ['compile-mustache']);
gulp.watch('./dist/**').on('change', livereload.changed);
});