forked from thiagosf/skitter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.babel.js
61 lines (54 loc) · 1.38 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
// Libs
import gulp from 'gulp'
import webserver from 'gulp-webserver'
import minify from 'gulp-minify'
import sass from 'gulp-sass'
import autoprefixer from 'gulp-autoprefixer'
import concat from 'gulp-concat'
import babel from 'gulp-babel'
// Scripts
gulp.task('scripts', ['compress'])
// Scripts watch
gulp.task('scripts:watch', () => {
return gulp.watch('src/**/*.js', ['scripts']);
})
// Script compress
gulp.task('compress', () => {
// return gulp.src(['src/skitter.js', 'src/animations/*.js', 'src/*.js'])
// .pipe(babel())
// .pipe(concat('jquery.skitter.js', { newLine: ';' }))
return gulp.src('src/*.js')
.pipe(minify({
mangle: false,
ext:{
src: '.js',
min: '.min.js'
}
}))
.pipe(gulp.dest('dist'))
})
// Styles
gulp.task('sass', () => {
return gulp.src('./scss/**/*.scss')
.pipe(sass({ outputStyle: 'compressed' }).on('error', sass.logError))
.pipe(autoprefixer())
.pipe(gulp.dest('./dist'));
})
// Styles watch
gulp.task('sass:watch', () => {
return gulp.watch('./scss/**/*.scss', ['sass']);
})
// Webserver
gulp.task('ws', ['scripts:watch', 'sass:watch'], () => {
return gulp.src('.')
.pipe(webserver({
host: '0.0.0.0',
port: 3000,
livereload: true,
directoryListing: false,
open: true,
fallback: 'index.html'
}));
})
// Build
gulp.task('dist', ['scripts', 'sass'])