This repository has been archived by the owner on Feb 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 205
/
Copy pathgulpfile.js
74 lines (63 loc) · 1.66 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
var bower = require('gulp-bower-files');
var connect = require('gulp-connect');
var distfile = require('./tasks/distfile');
var gulp = require('gulp');
var helptext = require('gulp-helptext');
var imports = require('./tasks/imports');
var rename = require('gulp-rename');
var through = require('through');
var rm = require('gulp-rm');
var uglify = require('gulp-uglify');
var vulcanize = require('gulp-vulcanize');
gulp.task('imports', ['clean'], function () {
return bower({
paths: {
bowerDirectory: 'bower_components'
}
}).pipe(imports())
.pipe(gulp.dest('dist'));
});
gulp.task('dist', ['clean', 'imports'], function () {
return bower({
paths: {
bowerDirectory: 'bower_components'
}
}).pipe(gulp.dest('dist'))
.pipe(distfile())
.pipe(gulp.dest('dist'));
});
gulp.task('minify.main', ['dist'], function () {
return gulp.src('dist/brick.html')
.pipe(rename(function (path) {
path.basename += '.min';
}))
.pipe(gulp.dest('dist'));
});
gulp.task('minify.vulcanize', ['minify.main'], function () {
return gulp.src('dist/brick.min.html')
.pipe(vulcanize({
dest: 'dist',
csp: true,
inline: true,
excludes: {
styles: ['font-awesome.css']
}
}))
.pipe(gulp.dest('dist'));
});
gulp.task('minify', ['minify.vulcanize']);
gulp.task('clean', function () {
return gulp.src('dist/**/*')
.pipe(rm());
});
gulp.task('build', ['clean', 'imports', 'dist', 'minify']);
gulp.task('help', helptext({
'help': 'This message'
}));
gulp.task('connect', function() {
connect.server({
port: 3001
});
});
gulp.task('server', ['build','connect']);
gulp.task('default', ['help']);