-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.babel.js
57 lines (49 loc) · 1.41 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
/* eslint-disable import/no-extraneous-dependencies */
import gulp from 'gulp';
// import babel from 'gulp-babel';
import eslint from 'gulp-eslint';
import postcss from 'gulp-postcss';
import autoprefixer from 'autoprefixer';
import postcssnested from 'postcss-nested';
import del from 'del';
import webpack from 'webpack-stream';
import webpackConfig from './webpack.config.babel';
const paths = {
allSrcJs: 'js/**/*.js?(x)',
allSrcCss: 'css/**/*.css',
gulpFile: 'gulpfile.babel.js',
webpackFile: 'webpack.config.babel.js',
entryPointJs: 'js/reqevents.jsx',
distDirJs: 'static/script/',
distDirCss: 'static/style/',
};
gulp.task('clean', () => del([paths.distDirJs, paths.distDirCss]));
gulp.task('build-js', ['lint', 'clean'], () =>
gulp.src(paths.entryPointJs)
.pipe(webpack(webpackConfig))
.pipe(gulp.dest(paths.distDirJs))
);
gulp.task('build-css', ['lint', 'clean'], () =>
gulp.src(paths.allSrcCss)
.pipe(postcss([
postcssnested,
autoprefixer({
browsers: ['last 1 version'],
}),
]))
.pipe(gulp.dest(paths.distDirCss))
);
gulp.task('build', ['build-js', 'build-css']);
gulp.task('default', ['build']);
gulp.task('lint', () =>
gulp.src([
paths.allSrcJs,
paths.gulpFile,
])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError())
);
gulp.task('watch', () => {
gulp.watch([paths.allSrcJs, paths.allSrcCss], ['default']);
});