-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
60 lines (53 loc) · 1.59 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
60
require('es6-promise').polyfill();
var gulp = require('gulp'),
sass = require('gulp-sass'),
rtlcss = require('gulp-rtlcss'),
autoprefixer = require('gulp-autoprefixer'),
plumber = require('gulp-plumber'),
gutil = require('gulp-util'),
rename = require('gulp-rename'),
concat = require('gulp-concat'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
imagemin = require('gulp-imagemin'),
browserSync = require('browser-sync').create(),
reload = browserSync.reload;
var onError = function( err ) {
console.log('An error occurred:', gutil.colors.magenta(err.message));
gutil.beep();
this.emit('end');
};
// Sass
gulp.task('sass', function() {
return gulp.src('./sass/**/*.scss')
.pipe(plumber({ errorHandler: onError }))
.pipe(sass())
.pipe(autoprefixer())
.pipe(gulp.dest('./'));
});
// JavaScript
gulp.task('js', function() {
return gulp.src(['./js/*.js'])
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(concat('app.js'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest('.'));
});
//Europe map
gulp.task('europeMap', function() {
return gulp.src(['./map/europe-panes.js'])
.pipe(uglify())
.pipe(gulp.dest('./map/'));
});
// Watch
gulp.task('watch', function() {
browserSync.init({
files: ['./**/*.php'],
proxy: 'http://dariah.dev/'
});
gulp.watch('./sass/**/*.scss', ['sass', reload]);
gulp.watch('./js/*.js', ['js', reload]);
});
gulp.task('default', gulp.series('sass', 'js', 'watch'));