-
-
Notifications
You must be signed in to change notification settings - Fork 43
/
gulpfile.babel.js
75 lines (58 loc) · 2.24 KB
/
gulpfile.babel.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
import {src, dest, parallel, series, watch} from 'gulp'
import autoprefixer from 'gulp-autoprefixer'
import eslint from 'gulp-eslint'
import rename from 'gulp-rename'
import sass from 'gulp-sass'
import sourcemaps from 'gulp-sourcemaps'
import webpackStream from 'webpack-stream'
import webpack from 'webpack'
const webpackConfig = require('./webpack.config')
const configDev = { mode: 'development', devtool: 'source-map', output: { filename: 'jquery.timeline.js' } }
const configProd = { mode: 'production' }
export const scripts = () => src('src/timeline.js')
.pipe(webpackStream( Object.assign( webpackConfig, configDev ), webpack, (err) => {
if ( err ) {
console.error( err )
}
}))
.pipe(dest('dist'))
export const deploy_scripts = () => src('src/timeline.js')
.pipe(webpackStream( Object.assign( webpackConfig, configProd ), webpack, (err) => {
if ( err ) {
console.error( err )
}
}))
.pipe(dest('dist'))
export const check = () => src('src/timeline.js')
.pipe(eslint({useEslintrc: true}))
.pipe(eslint.format())
.pipe(eslint.failAfterError())
export const styles = () => src('src/timeline.scss')
.pipe(sourcemaps.init())
.pipe(sass({outputStyle:'compressed'}))
.pipe(autoprefixer())
.pipe(rename('jquery.timeline.min.css'))
.pipe(sourcemaps.write('.'))
.pipe(dest('dist'))
export const deploy_styles = () => src('src/timeline.scss')
.pipe(sass({outputStyle:'compressed'}))
.pipe(autoprefixer())
.pipe(rename('jquery.timeline.min.css'))
.pipe(dest('dist'))
export const docsJS = () => src([
'dist/jquery.timeline.js',
'dist/jquery.timeline.js.map'
])
.pipe(dest('docs/js'))
export const docsCSS = () => src([
'dist/jquery.timeline.min.css',
'dist/jquery.timeline.min.css.map'
])
.pipe(dest('docs/css'))
//export default series( scripts, styles, docsJS, docsCSS )
export default series( parallel( series( check, scripts ), styles ), docsJS, docsCSS )
export const prod = parallel( deploy_scripts, deploy_styles )
export const dev = () => {
watch( 'src/timeline.js', series( check, scripts ) )
watch( 'src/timeline.scss', series( styles ) )
}