How to use the browser-sync.get function in browser-sync

To help you get started, we’ve selected a few browser-sync examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ovh-ux / gulp-drupal-stack / lib / icons.js View on Github external
function icons(done) {
    const stream = gulp.src(config.icons.src)
      .pipe(iconfont({
        fontName: iconName,
        appendUniconde: true,
        formats: config.icons.formats,
        timestamp: config.icons.useTimestamp ? runTimestamp : 0,
        autohint: config.icons.autohint,
        normalize: config.icons.normalize
      }));
    stream.pipe(gulp.dest(config.icons.dest));
    if (config.browserSync.enabled) {
      browserSync.get('server').reload();
    }
    if (config.icons.templates.enabled) {
      stream.on('glyphs', (glyphs) => {
        const iconData = {
          glyphs: glyphs.map(glyph => ({ // returns the object
            name: glyph.name,
            content: glyph.unicode[0].toString(16).toUpperCase()
          })),
          fontName: iconName,
          fontPath: config.icons.fontPathPrefix,
          classNamePrefix: config.icons.classNamePrefix
        };

        /**
         * Process Icon Templates
         * @param srcFile {string} - Path to lodash template file.
github springload / madewithwagtail / gulpfile.js / css.js View on Github external
var gulp = require("gulp");
var config = require("./config");
var fs = require("fs");
var path = require("path");

var sass = require("gulp-sass");
var plz = require("gulp-pleeease");
var gutil = require('gulp-util');
var size = require('gulp-size');
var bs = require('browser-sync').get('main');
var sourcemaps = require('gulp-sourcemaps');

/*
 ---------------------------------------------------------------------------
 Stylesheets
 ---------------------------------------------------------------------------
 */

gulp.task('css', function() {
    return gulp.src(path.join(config.paths.sass, "**", "*.scss"))
        .pipe(config.prod ? gutil.noop() : sourcemaps.init())
        .pipe(sass())
        .on('error', function handleError(err) {
            gutil.log(err.message);
            bs.notify(err.message, 10000);
            this.emit('end');
github samouss / angular2-jspm-starter / tasks / transpile.js View on Github external
return function transpileTS() {
    return gulp.src(files)
      .pipe(changed(destPath, { extension: '.js' }))
      .pipe(plumber({errorHandler: notify.onError("TS compilation failed !")}))
      .pipe(sourcemaps.init())
      .pipe(ts(config.compilerOptions))
      .pipe(sourcemaps.write())
      .pipe(gulp.dest(destPath))
      .pipe(bs.get('server').stream());
  }
}
github kerrishotts / Mastering-PhoneGap-Code-Package / logology-v12 / gulp / tasks / copy-scss.js View on Github external
* OTHER DEALINGS IN THE SOFTWARE.
 * 
 *****************************************************************************/

"use strict";

var gulp = require("gulp"),
    sass = require("gulp-sass"),
    autoprefixer = require("gulp-autoprefixer"),
    notify = require("gulp-notify"),
    sourcemaps = require("gulp-sourcemaps"),
    gutil = require("gulp-util"),
    config = require("../config"),
    settings = require("../settings"),
    paths = require("../utils/paths"),
    browserSync = require("browser-sync").get("www");

function copySCSS() {
    if (settings.NO_COPY) {
        return;
    }
    var isRelease = (settings.BUILD_MODE === "release");
    var includePaths = [];
    var includeModules = config.sass && config.sass.includeModules;
    if (includeModules instanceof Array) {
        includePaths = includePaths.concat(includeModules.map(function (moduleName) {
            var module = require(moduleName);
            return module.includePath;
        }));
    }
    var moreIncludePaths = config.sass && config.sass.includePaths;
    if (moreIncludePaths instanceof Array) {
github driesvints / driesvints.com / tasks / build.js View on Github external
callback: function() {
                    browserSyncInstance = BrowserSync.get('bs-webpack-plugin');
                },
            })
github kerrishotts / Mastering-PhoneGap-Code-Package / logology-v03 / gulp / tasks / copy-reload.js View on Github external
* permit persons to whom the Software is furnished to do so, subject to the following
 * conditions:
 * The above copyright notice and this permission notice shall be included in all copies
 * or substantial portions of the Software.
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
 * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 * 
 *****************************************************************************/

"use strict";

var browserSync = require("browser-sync").get("www");

module.exports = {
    deps: ["copy"],
    task: function () {browserSync.reload();}
}
github kerrishotts / Mastering-PhoneGap-Code-Package / logology-v11 / gulp / tasks / copy-reload.js View on Github external
* permit persons to whom the Software is furnished to do so, subject to the following
 * conditions:
 * The above copyright notice and this permission notice shall be included in all copies
 * or substantial portions of the Software.
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
 * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 * 
 *****************************************************************************/

"use strict";

var browserSync = require("browser-sync").get("www");

module.exports = {
    deps: ["copy"],
    task: function () {browserSync.reload();}
}
github kerrishotts / Mastering-PhoneGap-Code-Package / logology-v02 / gulp / tasks / copy-reload.js View on Github external
* permit persons to whom the Software is furnished to do so, subject to the following
 * conditions:
 * The above copyright notice and this permission notice shall be included in all copies
 * or substantial portions of the Software.
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
 * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 * 
 *****************************************************************************/

"use strict";

var browserSync = require("browser-sync").get("www");

module.exports = {
    deps: ["copy"],
    task: function () {browserSync.reload();}
}
github kerrishotts / Mastering-PhoneGap-Code-Package / logology-v07 / gulp / tasks / copy-reload.js View on Github external
* permit persons to whom the Software is furnished to do so, subject to the following
 * conditions:
 * The above copyright notice and this permission notice shall be included in all copies
 * or substantial portions of the Software.
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
 * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 * 
 *****************************************************************************/

"use strict";

var browserSync = require("browser-sync").get("www");

module.exports = {
    deps: ["copy"],
    task: function () {browserSync.reload();}
}
github ovh-ux / gulp-drupal-stack / lib / pattern-lab--php-twig.js View on Github external
core.sh(`php ${consolePath} --generate`, errorShouldExit, (err) => {
      if (config.browserSync.enabled) {
        browserSync.get('server').reload();
      }
      done(err);
    });
  }