-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathgulpfile.babel.js
More file actions
42 lines (36 loc) · 1.06 KB
/
Copy pathgulpfile.babel.js
File metadata and controls
42 lines (36 loc) · 1.06 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
import gulp from 'gulp';
import webpack from 'webpack';
import gutil from 'gulp-util';
import del from 'del';
import rename from 'gulp-rename';
import sass from 'gulp-sass';
import cleanCSS from 'gulp-clean-css';
import webpackConfig from './webpack.config.dist.babel';
gulp.task('clean', () =>
del(['./dist/*']),
);
gulp.task('webpack:build', () => {
webpack(webpackConfig, (err, stats) => {
if (err) {
throw new gutil.PluginError('webpack:build', err);
}
gutil.log('[webpack:build]', stats.toString({
colors: true,
}));
});
});
gulp.task('sass:watch', () =>
gulp.watch('./src/assets/sass/*.scss', ['sass']),
);
gulp.task('sass', () =>
gulp.src(['./src/assets/sass/*.{scss,sass}'])
.pipe(sass({ includePaths: ['bower_components', 'node_modules'], errLogToConsole: true }))
.pipe(gulp.dest('./dist'))
.pipe(rename({ suffix: '.min' }))
.pipe(cleanCSS({ compatibility: 'ie8' }))
.pipe(gulp.dest('./dist')),
);
gulp.task('build', ['webpack:build', 'sass'], () =>
del('./dist/video.css'),
);
gulp.task('default', ['clean', 'build']);