-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
61 lines (54 loc) · 1.28 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
61
/**
* Include Gulp & tools to use
*/
var gulp = require('gulp');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var browserSync = require('browser-sync').create();
const sourcemaps = require('gulp-sourcemaps');
var reload = browserSync.reload;
/**
* configs
*/
var config = {
url: "soapatricksix.local",
scssSrc: './scss/*.scss',
scssDest: './css'
};
/**
* compile sass for development
*/
gulp.task("sass", function() {
return gulp
.src(config.scssSrc)
.pipe(sass({
errLogToConsole: true,
outputStyle: 'expanded'
}).on("error", sass.logError))
.pipe(gulp.dest(config.scssDest))
.pipe(browserSync.stream({ match: "**/*.css" }));
});
/**
* compile sass for deployment
*/
gulp.task("default", function() {
return gulp
.src(config.scssSrc)
.pipe(sass({
outputStyle: 'compressed'
}).on("error", sass.logError))
.pipe(gulp.dest(config.scssDest));
});
/**
* watch task with browser reload
*/
gulp.task("watch", function() {
browserSync.init({
proxy: config.url,
injectChanges: true,
notify: false
});
gulp.watch(["./scss/**/*.scss"], gulp.series('sass'));
gulp.watch(["./js/**/*.js"]).on("change", browserSync.reload);
gulp.watch(["./**/*.php"]).on("change", browserSync.reload);
});