Skip to content

Instantly share code, notes, and snippets.

@deepfriedfilth
Last active December 6, 2018 20:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deepfriedfilth/4085247165dbfe798a03321788c62da3 to your computer and use it in GitHub Desktop.
Save deepfriedfilth/4085247165dbfe798a03321788c62da3 to your computer and use it in GitHub Desktop.
minimal gulp config
var gulp = require('gulp');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var browserSync = require('browser-sync').create();
var reload = browserSync.reload;
gulp.task('styles', function(done) {
/* Sass it up, pack it up */
gulp.src('sass/**/*.scss')
.pipe(sourcemaps.init())
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./'));
done();
});
gulp.task('html', function(done) {
done();
});
gulp.task('php', function(done) {
done();
});
gulp.task('js', function(done) {
done();
});
gulp.task('watch:sass', function(done) {
return gulp.watch('sass/**/*.scss',gulp.series('styles')).on('change', reload);
});
gulp.task('watch:html', function(done) {
return gulp.watch('**/*.html',gulp.series('html')).on('change', reload);
});
gulp.task('watch:php', function(done) {
return gulp.watch('**/*.php',gulp.series('php')).on('change', reload);
});
gulp.task('watch:js', function(done) {
return gulp.watch('js/**/*.js',gulp.series('js')).on('change', reload);
});
gulp.task('sync', function(done) {
browserSync.init({
proxy: 'locally-set-domain.dev',
browser: 'google chrome'
});
done();
});
gulp.task('watch', gulp.parallel('watch:js', 'watch:sass', 'watch:php', 'watch:html'));
gulp.task('default', gulp.series('sync', 'watch'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment