-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
69 lines (60 loc) · 1.49 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
/* eslint-disable no-console */
const gulp = require('gulp')
const rename = require('gulp-rename')
const uglifyCss = require('gulp-uglifycss')
const uglifyJs = require('gulp-uglify')
const babel = require('gulp-babel')
const gutil = require('gulp-util')
const destinationDir = './simona_table'
const sourceDir = './src'
gulp.task('handsontable', () => {
gulp.src([
'./node_modules/handsontable/dist/handsontable.full.min.js',
'./node_modules/numbro/dist/languages.min.js',
])
.pipe(gulp.dest(`${destinationDir}/js`))
gulp.src([
'./node_modules/handsontable/dist/handsontable.full.min.css',
])
.pipe(gulp.dest(`${destinationDir}/css`))
})
gulp.task('css', () => {
gulp.src([
`${sourceDir}/**/*.css`,
])
.pipe(uglifyCss({
'maxLineLen': 80,
'uglyComments': true,
}))
.on('error', gutil.log)
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest(`${destinationDir}/css`))
})
gulp.task('js', () => {
gulp.src([
`${sourceDir}/**/*.js`,
])
.pipe(babel({
presets: ['babel-preset-env'].map(require.resolve),
}))
.on('error', gutil.log)
.pipe(uglifyJs())
.on('error', gutil.log)
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest(`${destinationDir}/js`))
})
gulp.task('watchCss', () => {
gulp.watch(`${sourceDir}/**/*.css`, ['css'])
})
gulp.task('watchJs', () => {
gulp.watch(`${sourceDir}/**/*.js`, ['js'])
})
gulp.task('watch', [
'watchCss',
'watchJs',
])
gulp.task('build', [
'handsontable',
'css',
'js',
])