forked from dennisreimann/uiengine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
41 lines (34 loc) · 1.13 KB
/
Copy pathgulpfile.js
File metadata and controls
41 lines (34 loc) · 1.13 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
const gulp = require('gulp')
const { dirname, join } = require('path')
const runSequence = require('run-sequence')
const webpack = require('webpack')
const webpackStream = require('webpack-stream')
const p = require('gulp-load-plugins')()
const webpackEnv = process.env.NODE_ENV === 'production' ? 'prod' : 'dev'
const webpackConfig = require(join(__dirname, `build/webpack.${webpackEnv}.conf.js`))
const src = {
lib: ['./src/*.js'],
webpack: ['src/{styles,templates,vue}/**/*']
}
gulp.task('lib', () =>
gulp.src(src.lib)
.pipe(p.plumber())
.pipe(p.babel())
.pipe(gulp.dest('./lib'))
)
gulp.task('hljs', () =>
gulp.src(`${dirname(require.resolve('highlight.js/styles/github.css'))}/**`)
.pipe(gulp.dest('./static/styles/hljs'))
)
gulp.task('webpack', () =>
gulp.src('src/scripts/main.js')
.pipe(p.plumber())
.pipe(webpackStream(webpackConfig, webpack))
.pipe(gulp.dest('./dist'))
)
gulp.task('watch', () => {
gulp.watch(src.lib, ['lib'])
gulp.watch(src.webpack, ['webpack'])
})
gulp.task('build', cb => runSequence(['lib', 'hljs'], ['webpack'], cb))
gulp.task('develop', cb => runSequence('build', 'watch', cb))