-
Notifications
You must be signed in to change notification settings - Fork 19
/
gulpfile.js
33 lines (29 loc) · 1.01 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
'use strict';
const gulp = require('gulp');
const concat = require('gulp-concat');
const uglify = require('gulp-uglify');
const path = require('path');
const fs = require('fs');
const conf = require('./app/conf');
gulp.task('default', ['scripts']);
gulp.task('scripts', () => {
// generate consts.js
const fd = fs.openSync(path.join(__dirname, 'resource/scripts/consts.js'), 'w');
fs.writeSync(fd, `usernameRegex = ${conf.user.usernameRegex};\n`);
fs.writeSync(fd, `emailRegex = ${conf.email.validation.emailRegex};\n`);
fs.closeSync(fd);
return gulp.src([
'resource/scripts/consts.js',
'resource/scripts/jquery-addon.js',
'resource/scripts/form.js',
'resource/scripts/signup.js',
'resource/scripts/login.js',
'resource/scripts/profile.js',
'resource/scripts/reset-public.js',
'resource/scripts/reset-private.js',
'bower_components/cryptojslib/rollups/sha512.js'
])
.pipe(concat('min.js'))
.pipe(uglify())
.pipe(gulp.dest('resource/scripts/'));
});