-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
67 lines (57 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
60
61
62
63
64
65
66
67
var gulp = require('gulp'),
sass = require('gulp-sass'),
sourcemaps = require('gulp-sourcemaps'),
cleanCss = require('gulp-clean-css'),
rename = require('gulp-rename'),
postcss = require('gulp-postcss'),
autoprefixer = require('autoprefixer'),
browserSync = require('browser-sync'),
nodemon = require('gulp-nodemon');
gulp.task('build-theme', function() {
return gulp.src(['scss/*.scss'])
.pipe(sourcemaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(postcss([ autoprefixer({ browsers: [
'Chrome >= 35',
'Firefox >= 38',
'Edge >= 12',
'Explorer >= 10',
'iOS >= 8',
'Safari >= 8',
'Android 2.3',
'Android >= 4',
'Opera >= 12']})]))
.pipe(sourcemaps.write())
.pipe(gulp.dest(''))
.pipe(cleanCss())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest(''))
});
gulp.task('watch', ['build-theme'], function() {
gulp.watch(['scss/*.scss'], ['build-theme']);
});
gulp.task('default', ['build-theme'], function() {
});
gulp.task('browser-sync',['watch','nodemon'], function() {
browserSync.init(null, {
proxy: "http://localhost:8080",
files: ["./**/*.*"],
browser: "google chrome",
port: 8080,
});
});
gulp.task('nodemon', function (cb) {
var started = false;
return nodemon({
script: 'app.js'
}).on('start', function () {
// to avoid nodemon being started multiple times
// thanks @matthisk
if (!started) {
cb();
started = true;
}
});
});
gulp.task('run', ['browser-sync'], function() {
});