This repository was archived by the owner on Nov 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGulpfile.js
More file actions
72 lines (62 loc) · 1.65 KB
/
Copy pathGulpfile.js
File metadata and controls
72 lines (62 loc) · 1.65 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
'use strict';
var gulp = require('gulp'),
autoprefixer = require('gulp-autoprefixer'),
//bourbon = require('node-bourbon'),
sass = require('gulp-sass'),
watch = require('gulp-watch'),
wait = require('gulp-wait'),
// wait = require('gulp-wait'),
uglify = require('gulp-uglifyjs'),
browserSync = require('browser-sync').create(),
babel = require("gulp-babel");
// Scss stylesheets
gulp.task('stylesheets', function() {
return gulp.src('stylesheets/**/*.scss')
// .pipe(wait(150))
.pipe(wait(150))
.pipe(sass({
outputStyle: 'compressed',
//includePaths: bourbon.includePaths
})).on('error', sass.logError)
.pipe(autoprefixer({
browsers: ["last 3 version", "> 1%" , "ie 8"]
}))
.pipe(gulp.dest('css/'))
.pipe(browserSync.stream());
});
gulp.task('watch', function() {
watch(['stylesheets/**/*.scss'], function(event, cb) {
gulp.start('stylesheets');
});
watch(['./js/main.js'], function(event, cb) {
gulp.start('uglify');
});
gulp.watch("./*.html").on('change', browserSync.reload);
gulp.watch("./js/*.js").on('change', browserSync.reload);
});
gulp.task('serve', function() {
browserSync.init({
server: "./",
open: true,
port: 8081
});
});
gulp.task('uglify', function() {
gulp.src('./js/main.js')
.pipe(babel({
presets: ['es2015']
}))
.pipe(uglify())
.pipe(gulp.dest('./js/min'))
});
// Run
gulp.task('default', [
'stylesheets',
'serve',
'uglify',
'watch'
]);
gulp.task('wp', [
'stylesheets',
'watch'
]);