forked from somewebmedia/hc-offcanvas-nav
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
executable file
·59 lines (54 loc) · 1.53 KB
/
gulpfile.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
const gulp = require('gulp');
const sass = require('gulp-sass');
const autoprefixer = require('gulp-autoprefixer');
const uglify = require('gulp-uglify');
const saveLicense = require('uglify-save-license');
const babel = require('gulp-babel');
const through = require('through2');
const path = require('path');
const argv = require('yargs').argv;
gulp.task('js', () => {
return gulp.src(['./src/js/*.js'])
.pipe(babel(
{
presets: [
[
'@babel/preset-env',
{
modules: false
}
]
]
}
))
.pipe(argv.dev ? through.obj() : uglify({
output: {
comments: saveLicense
}
}))
.pipe(gulp.dest('./docs/'))
.pipe(gulp.dest('./dist/'));
});
gulp.task('scss', () => {
return gulp.src(['./src/scss/*.scss', '!./src/scss/demo.scss'])
.pipe(sass({
'includePaths': ['node_modules'],
'outputStyle': argv.dev ? 'development' : 'compressed'
}).on('error', sass.logError))
.pipe(autoprefixer())
.pipe(gulp.dest('./dist/'));
});
gulp.task('demo', () => {
return gulp.src(['./src/scss/demo.scss'])
.pipe(sass({
'includePaths': ['node_modules'],
'outputStyle': argv.dev ? 'development' : 'compressed'
}).on('error', sass.logError))
.pipe(autoprefixer())
.pipe(gulp.dest('./docs/'));
});
gulp.task('default', ['js', 'scss', 'demo'], () => {});
gulp.task('watch', ['default'], () => {
gulp.watch(['./src/js/*.js'], ['js']);
gulp.watch(['./src/scss/*.scss'], ['scss', 'demo']);
});