-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
44 lines (36 loc) · 1.07 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
var gulp = require('gulp');
var browserify = require('gulp-browserify');
var uglify = require('gulp-uglify');
var rename = require("gulp-rename");
var jsonfile = require('jsonfile')
gulp.task('default', [ 'build', 'gen-sub' ]);
gulp.task('gen-sub', function()
{
const subscriberSet = jsonfile.readFileSync( './json/v2/subscriber.json' );
const subscriberTemplate = subscriberSet.template;
for( var index in subscriberSet.channels )
{
const file = `./dist/channels/${index}.json`;
const channels = {};
channels[ index ] = subscriberSet.channels[ index ];
const obj =
{
template : subscriberTemplate,
channels : channels
};
jsonfile.writeFileSync( file, obj );
}
});
gulp.task('build', function()
{
return gulp.src('twitchemoji.js')
.pipe(browserify({
insertGlobals : true,
standalone : 'twitchEmoji'
}))
.pipe(uglify())
.pipe(rename({
suffix : '.min'
}))
.pipe(gulp.dest('./dist'));
});