Created
August 17, 2020 08:31
-
-
Save tommylinks/42bd4d918ac51442cac8915d295331f6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
var sass = require('gulp-sass'); | |
var connectPHP = require('gulp-connect-php'); | |
var browserSync = require('browser-sync'); | |
var reload = browserSync.reload; | |
var sourcemaps = require('gulp-sourcemaps'); | |
var paths = { | |
html: ['./**/*.php'], | |
js: ['./js/*.js'] | |
}; | |
gulp.task('html', function(){ | |
gulp.src(paths.html) | |
.pipe(reload({stream:true})); | |
}); | |
gulp.task('js', function(){ | |
gulp.src(paths.js) | |
.pipe(reload({stream:true})); | |
}); | |
gulp.task('sass', function () { | |
return gulp.src('./stylesheets/**/*.sass') | |
.pipe(sourcemaps.init()) | |
.pipe(sass().on('error', sass.logError)) | |
.pipe(sourcemaps.write('./maps')) | |
.pipe(gulp.dest('./css')) | |
.pipe(reload({stream:true})); | |
}); | |
gulp.task('browserSync', function() { | |
browserSync({ | |
proxy:'tubik-blog.loc', | |
port:8080 | |
}); | |
}); | |
gulp.task('build', function () { | |
gulp.watch(paths.html, gulp.parallel('html')); | |
gulp.watch(paths.js, gulp.parallel('js')); | |
gulp.watch('./stylesheets/**/*.sass', gulp.parallel('sass')); | |
gulp.watch('**/*.php').on('change', function () { | |
browserSync.reload(); | |
}); | |
}); | |
gulp.task('watch', gulp.parallel('sass')); | |
gulp.task('default', gulp.parallel('build', 'browserSync')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment