{"size": 1248, "ext": "js", "max_stars_repo_path": "node_modules/laravel-elixir/tasks/browsersync.js", "max_stars_repo_name": "sidis405/sp", "max_stars_repo_stars_event_min_datetime": "2016-01-30T02:44:09.000Z", "max_stars_repo_stars_event_max_datetime": "2016-01-30T03:27:22.000Z", "max_issues_repo_path": "node_modules/laravel-elixir/tasks/browsersync.js", "max_issues_repo_name": "sidis405/sp", "max_issues_repo_issues_event_min_datetime": "2016-11-10T13:24:49.000Z", "max_issues_repo_issues_event_max_datetime": "2016-11-10T13:24:49.000Z", "max_forks_repo_path": "node_modules/laravel-elixir/tasks/browsersync.js", "max_forks_repo_name": "sidis405/sp", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 3, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 31.2, "max_line_length": 79, "alphanum_fraction": 0.5376602564}
var gulp = require('gulp');
var _ = require('underscore');
var gutils = require('gulp-util');
var Elixir = require('laravel-elixir');
var browserSync = require('browser-sync').create();

var config = Elixir.config;

/*
 |----------------------------------------------------------------
 | BrowserSync
 |----------------------------------------------------------------
 |
 | Browsersync makes your browser testing workflow faster by
 | synchronizing URLs, behavior, and code changes across
 | across multiple devices. And, now it's in Elixir!
 |
 */

Elixir.extend('browserSync', function (options) {
    options = _.extend(config.browserSync, {
        files: [
            config.appPath + '/**/*.php',
            config.get('public.css.outputFolder') + '/**/*.css',
            config.get('public.js.outputFolder') + '/**/*.js',
            config.get('public.versioning.buildFolder') + '/rev-manifest.json',
            'resources/views/**/*.php'
        ],
        watchOptions: {
            usePolling: true
        }
    }, options);

    // Browsersync will only run during `gulp watch`.
    if (gutils.env._.indexOf('watch') > -1) {
        browserSync.init(options);
    }

    new Elixir.Task('browserSync', function () {}).watch();
});