-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
74 lines (56 loc) · 1.35 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
74
//==============//
// DEPENDENCIES //
//==============//
// Local dependencies.
const pkg = require('./package.json');
// Node dependencies.
const fs = require('fs');
// Third-party dependencies.
const del = require('del');
const gulp = require('gulp');
const rename = require('gulp-rename');
const uglify = require('gulp-uglify');
const gutil = require('gulp-util');
const concat = require('gulp-concat');
const header = require('gulp-header');
const serverFactory = require('spa-server');
//=========//
// GLOBALS //
//=========//
//=======//
// CLEAN //
//=======//
gulp.task('clean', () => del('dist'));
//=======//
// BUILD //
//=======//
gulp.task('build', ['clean'], () => {
const headerContent = fs.readFileSync('src/header.js', 'utf8');
return gulp
.src([
'./src/module.js'
])
.pipe(concat('betsol-load-stylesheet.js'))
.pipe(header(headerContent, { pkg : pkg } ))
.pipe(gulp.dest('dist'))
.pipe(uglify())
.pipe(header(headerContent, { pkg : pkg } ))
.pipe(rename('betsol-load-stylesheet.min.js'))
.pipe(gulp.dest('dist'))
.on('error', gutil.log)
;
});
//======//
// DEMO //
//======//
gulp.task('demo', () => {
const server = serverFactory.create({
path: './demo',
port: 1337
});
server.start();
});
//==============//
// DEFAULT TASK //
//==============//
gulp.task('default', ['build']);