From 421790fa122ea17b79a89ab1e9bf31196fa9afef Mon Sep 17 00:00:00 2001 From: Nikolai R Kristiansen Date: Sun, 28 Aug 2016 22:07:31 +0200 Subject: [PATCH] replaces livereload with browserSync --- wp-content/themes/aktiv2014/gulpfile.js | 14 ++++++++------ wp-content/themes/aktiv2014/package.json | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/wp-content/themes/aktiv2014/gulpfile.js b/wp-content/themes/aktiv2014/gulpfile.js index 6529114..2b8d50c 100644 --- a/wp-content/themes/aktiv2014/gulpfile.js +++ b/wp-content/themes/aktiv2014/gulpfile.js @@ -5,8 +5,9 @@ var gulp = require('gulp'); // load plugins var $ = require('gulp-load-plugins')(); -var bowerFiles = require('main-bower-files'); var autoprefixer = require('autoprefixer'); +var bowerFiles = require('main-bower-files'); +var browserSync = require('browser-sync'); var cssnano = require('cssnano'); gulp.task('styles', function () { @@ -20,7 +21,8 @@ gulp.task('styles', function () { .pipe($.postcss([ autoprefixer({browsers: ['last 1 version']}) ])) - .pipe(gulp.dest('dist/styles')); + .pipe(gulp.dest('dist/styles')) + .pipe(browserSync.stream()); }); gulp.task('diststyles', function () { @@ -91,17 +93,17 @@ gulp.task('default', ['clean'], function () { }); gulp.task('watch', ['styles'], function () { - // FIXME(nikolark): replace with browsersync - $.livereload.listen(); + browserSync.init({ + proxy: "aktiv-www.dev" + }); // watch for changes - gulp.watch([ '*.php', 'dist/styles/**/*.css', 'dist/scripts/**/*.js', 'dist/images/**/*' - ]).on('change', $.livereload.changed); + ]).on('change', browserSync.reload); gulp.watch('app/styles/**/*.scss', ['styles']); gulp.watch('app/scripts/**/*.js', ['scripts']); diff --git a/wp-content/themes/aktiv2014/package.json b/wp-content/themes/aktiv2014/package.json index d752a35..50bf297 100644 --- a/wp-content/themes/aktiv2014/package.json +++ b/wp-content/themes/aktiv2014/package.json @@ -4,9 +4,10 @@ "version": "0.0.1", "devDependencies": { "autoprefixer": "^6.4.0", + "browser-sync": "^2.14.0", "cssnano": "^3.7.4", "del": "^2.2.2", - "gulp": "^3.8.10", + "gulp": "^3.9.1", "gulp-cache": "^0.4.5", "gulp-concat": "~2.6.0", "gulp-filter": "^4.0.0", @@ -14,7 +15,6 @@ "gulp-if": "^2.0.1", "gulp-imagemin": "^3.0.3", "gulp-jshint": "^2.0.1", - "gulp-livereload": "^3.7.0", "gulp-load-plugins": "^1.2.4", "gulp-plumber": "~1.1.0", "gulp-postcss": "~6.1.1",