-
Notifications
You must be signed in to change notification settings - Fork 68
/
gulpfile.js
138 lines (121 loc) · 4.17 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
var gulp = require('gulp'),
vulcanize = require('gulp-vulcanize'),
compass = require('gulp-compass'),
plumber = require('gulp-plumber'),
path = require('path'),
concat = require('gulp-concat'),
coffee = require('gulp-coffee'),
sourcemaps = require('gulp-sourcemaps'),
runSequence = require('run-sequence'),
browserSync = require('browser-sync'),
del = require('del'),
zip = require('gulp-zip');
gulp.task('default', ['html', 'compass', 'coffee', 'libs', 'copy'])
gulp.task('package', function() {
return runSequence('html', 'compass', 'coffee', 'libs', 'copy', 'zip');
})
gulp.task('html', function() {
return runSequence('columns', 'vulcanize', function() {
del('src/columns/compiled')
});
})
gulp.task('columns', function() {
return gulp.src('src/columns/**/*.html')
.pipe(plumber())
.pipe(concat('columns.html'))
.pipe(gulp.dest('src/columns/compiled'))
})
gulp.task('libs', function() {
return gulp.src([
'bower_components/web-animations-js/web-animations-next-lite.min.js',
'bower_components/polymer/polymer.js',
'bower_components/core-focusable/core-focusable.js',
'bower_components/core-focusable/polymer-mixin.js',
'bower_components/packery/dist/packery.pkgd.js',
'bower_components/store.js/store.js',
'bower_components/color-thief/src/color-thief.js',
'bower_components/draggabilly/dist/draggabilly.pkgd.js',
'bower_components/fetch/fetch.js',
'bower_components/momentjs/moment.js',
'bower_components/pleasejs/src/Please.js',
'bower_components/pushbullet-js/pushbullet.js',
'bower_components/URIjs/src/URI.min.js',
'bower_components/underscore/underscore-min.js'
])
.pipe(concat('libs.js'))
.pipe(gulp.dest('dist/js'))
})
gulp.task('copy', function() {
//for files that don't need to be compiled. but just copied
gulp.src('src/font/*')
.pipe(gulp.dest("dist/font"));
gulp.src('src/img/*')
.pipe(gulp.dest("dist/img"));
return gulp.src('src/manifest.json')
.pipe(gulp.dest('dist'))
})
gulp.task('zip', function() {
return gulp.src("dist/**")
.pipe(zip('tabbie.zip'))
.pipe(gulp.dest('./'))
});
gulp.task('vulcanize', function () {
return gulp.src('src/**.html')
.pipe(plumber())
.pipe(vulcanize({
dest: 'dist',
strip: false,
csp: true, // chrome does not approve of inline scripts
excludes: {
imports: [
//do not use roboto import because it requires external server (imported trough screen.scss)
'roboto.html',
//do not use the following imports as they try to import scripts from it's bower location, which we don't package.
//(these get packaged in libs.js)
'core-focusable.html',
'polymer.html',
'web-animations.html'
]
}
}))
.pipe(gulp.dest('dist'))
});
gulp.task('coffee', function() {
return gulp.src('src/**/*.coffee')
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(coffee({
bare: true
}))
.pipe(concat('main.js'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist/js'))
});
gulp.task('compass', function() {
return gulp.src('src/sass/*.scss')
.pipe(plumber())
.pipe(compass({
project: path.join(__dirname, 'src'),
css: path.join(__dirname, 'dist/css'),
sourcemap: true
}))
.pipe(gulp.dest('dist/css'));
});
gulp.task('serve', ['default'], function () {
browserSync({
server: {
baseDir: '.'
},
startPath: 'dist/tab.html',
reloadDelay: 1500
});
});
gulp.task('reload', function () {
return browserSync.reload();
});
gulp.task('watch', ['default'], /*['serve'], */function () {
gulp.watch('src/**/*.scss', ['compass', 'reload']);
gulp.watch('src/**/*.html', ['html', 'reload']);
gulp.watch('src/**/*.coffee', ['coffee', 'reload']);
gulp.watch('src/manifest.json', ['copy']);
});