StartBootstrap/startbootstrap-grayscale

How do you turn off BrowserSync?

Su4o opened this issue · 0 comments

Su4o commented

I don't want browsersync on the web I'm making, but when I change the code, it failed (SIGTERM error)

Here's the code (start.js),

const concurrently = require('concurrently');
const upath = require('upath');

const browserSyncPath = upath.resolve(upath.dirname(__filename), '../node_modules/.bin/browser-sync');

concurrently([
{ command: 'node scripts/sb-watch.js', name: 'SB_WATCH', prefixColor: 'bgBlue.bold' },
{
command: echo 'BrowserSync is disabled', // Instead of running BrowserSync command, echo a message indicating that it's disabled
name: 'SB_BROWSER_SYNC',
prefixColor: 'bgGreen.bold',
}
], {
prefix: 'name',
killOthers: ['failure', 'success'],
}).then(success, failure);

function success() {
console.log('Success');
}

function failure() {
console.log('Failure');
}


Also, I changed the sb-watch.js Here's the code,

'use strict';

const _ = require('lodash');
const chokidar = require('chokidar');
const upath = require('upath');
const renderAssets = require('./render-assets');
const renderPug = require('./render-pug');
const renderScripts = require('./render-scripts');
const renderSCSS = require('./render-scss');

const watcher = chokidar.watch('src', {
persistent: true,
});

let READY = false;

process.title = 'pug-watch';
process.stdout.write('Loading');
let allPugFiles = {};

watcher.on('add', filePath => _processFile(upath.normalize(filePath), 'add'));
watcher.on('change', filePath => _processFile(upath.normalize(filePath), 'change'));
watcher.on('ready', () => {
READY = true;
console.log(' READY TO ROLL!');
});

_handleSCSS();

function _processFile(filePath, watchEvent) {

if (!READY) {
    if (filePath.match(/\.pug$/)) {
        if (!filePath.match(/includes/) && !filePath.match(/mixins/) && !filePath.match(/\/pug\/layouts\//)) {
            allPugFiles[filePath] = true;
        }
    }
    process.stdout.write('.');
    return;
}

console.log(`### INFO: File event: ${watchEvent}: ${filePath}`);

if (filePath.match(/\.pug$/)) {
    return _handlePug(filePath, watchEvent);
}

if (filePath.match(/\.scss$/)) {
    if (watchEvent === 'change') {
        return _handleSCSS(filePath, watchEvent);
    }
    return;
}

if (filePath.match(/src\/js\//)) {
    return renderScripts();
}

if (filePath.match(/src\/assets\//)) {
    return renderAssets();
}

}

function _handlePug(filePath, watchEvent) {
if (watchEvent === 'change') {
if (filePath.match(/includes/) || filePath.match(/mixins/) || filePath.match(//pug/layouts//)) {
return _renderAllPug();
}
return renderPug(filePath);
}
if (!filePath.match(/includes/) && !filePath.match(/mixins/) && !filePath.match(//pug/layouts//)) {
return renderPug(filePath);
}
}

function _renderAllPug() {
console.log('### INFO: Rendering All');
_.each(allPugFiles, (value, filePath) => {
renderPug(filePath);
});
}

function _handleSCSS() {
renderSCSS();
}


What am I doing wrong?