forked from russellsamora/responsive-table-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
56 lines (51 loc) · 1.28 KB
/
gulpfile.js
File metadata and controls
56 lines (51 loc) · 1.28 KB
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
const gulp = require('gulp')
const replace = require('gulp-replace-task')
const fileinclude = require('gulp-file-include')
const browserSync = require('browser-sync')
const babel = require('gulp-babel')
// Default task to be run with `gulp`
gulp.task('default', () => {
gulp.watch('src/table-style.css', ['css'])
gulp.watch(['src/responsive-table.js', '.tmp/table-style.css'], ['js'])
gulp.watch(['index.html', '*.css', '*.js'], ['browser-sync-reload'])
gulp.start('browser-sync')
})
gulp.task('css', () => {
gulp.src('src/table-style.css')
.pipe(replace({
patterns: [
{
match: /\t/g,
replacement: '\\t'
}, {
match: /\n/g,
replacement: '\\n'
}, {
match: 'max',
replacement: '${options.breakpoint}'
}
]
}))
.pipe(gulp.dest('.tmp'))
})
gulp.task('js', () => {
gulp.src('src/responsive-table.js')
.pipe(fileinclude())
.pipe(babel())
.pipe(gulp.dest('./docs'))
.pipe(browserSync.reload({ stream: true }))
})
// browser-sync task for starting the server.
gulp.task('browser-sync', () => {
browserSync({
server: {
baseDir: './docs',
index: 'index.html'
},
notify: false,
ghostMode: false
})
})
gulp.task('browser-sync-reload', () => {
browserSync.reload()
})