-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
executable file
·54 lines (49 loc) · 1.71 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
var autoprefixer = require('gulp-autoprefixer'); // https://www.npmjs.com/package/gulp-autoprefixer/
var browserSync = require('browser-sync').create(); // http://www.browsersync.io/docs/gulp/
var concat = require('gulp-concat'); // https://www.npmjs.com/package/gulp-concat/
var gulp = require('gulp'); // https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md
var sass = require('gulp-sass'); // https://www.npmjs.com/package/gulp-sass/
gulp.task('js', function() {
return gulp.src(['./js/skip-link-focus-fix.js', './js/davidparsons.js'])
.pipe(concat('scripts.js'))
.pipe(gulp.dest('./dist/'))
.pipe(browserSync.stream());
});
// sass -> css -> combine
gulp.task('sass', function () {
gulp.src('./sass/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./css'))
.pipe(autoprefixer({
browsers: [
'last 2 versions'
]
}))
.pipe(gulp.dest('dist'))
// .pipe(gulp.dest('dist'))
.pipe(browserSync.stream());
});
// ### Watch
gulp.task('watch', function() {
browserSync.init({
files: ['{lib,templates}/**/*.php', '*.php'],
// proxy: config.devUrl,
proxy: 'localhost',
snippetOptions: {
whitelist: ['/wp-admin/admin-ajax.php'],
blacklist: ['/wp-admin/**']
}
});
// gulp.watch([path.source + 'styles/**/*'], ['styles']);
// gulp.watch([path.source + 'scripts/**/*'], ['jshint', 'scripts']);
// gulp.watch([path.source + 'fonts/**/*'], ['fonts']);
// gulp.watch([path.source + 'images/**/*'], ['images']);
// gulp.watch(['bower.json', 'assets/manifest.json'], ['build']);
gulp.watch('js/**/*', ['js']);
gulp.watch('sass/**/*', ['sass']);
gulp.watch('*.php').on('change', browserSync.reload);
});
// ### Watch
gulp.task('default', function() {
// deafult tasks
});