Skip to content

Commit

Permalink
Remove browser-sync
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Clifton <[email protected]>
Co-authored-by: Jamie B <[email protected]>
Co-authored-by: Marjan Kalanaki <[email protected]>
Co-authored-by: Simon Adcock <[email protected]>
  • Loading branch information
5 people committed Feb 12, 2025
1 parent 1450202 commit dd183be
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 674 deletions.
100 changes: 0 additions & 100 deletions dev/bs-config.mjs

This file was deleted.

28 changes: 4 additions & 24 deletions dev/watch.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
import path, { dirname } from 'path';
import cpy from 'cpy';
import chalk from 'chalk';
import { create } from 'browser-sync';
import bsConfig from './bs-config.mjs';

const browserSync = create();

// ********************************** JAVASCRIPT **********************************

Expand Down Expand Up @@ -41,19 +37,14 @@ const watchArguments = [
INITIAL_BUNDLE = false;
wpNotification.succeed();

// now have the initial bundles, we can start browsersync
return browserSync.init(bsConfig);
return undefined;
}

const info = stats.toJson();
// send editing errors to console and browser
if (stats.hasErrors()) {
console.log(chalk.red(info.errors));
return browserSync.sockets.emit('fullscreen:message', {
title: 'Webpack Error:',
body: info.errors,
timeout: 100_000,
});
return undefined;
}

if (stats.hasWarnings()) {
Expand All @@ -68,7 +59,7 @@ const watchArguments = [
colors: true,
}),
);
return browserSync.reload();
return undefined;
},
];

Expand Down Expand Up @@ -152,21 +143,10 @@ chokidar.watch(`${sassDir}/**/*.scss`).on('change', (changedFile) => {
),
)
.then(() => {
// clear any previous error messages
browserSync.sockets.emit('fullscreen:message:clear');

// announce the changes
browserSync.reload(
filesToCompile.map((file) => file.replace('scss', 'css')),
);
console.log(chalk.green('✔️ Stylesheets compiled'));
})
.catch((e) => {
// send editing errors to console and browser
console.log(chalk.red(`\n${e.formatted}`));
browserSync.sockets.emit('fullscreen:message', {
title: 'CSS Error:',
body: e.formatted,
timeout: 100_000,
});
});
});
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
"bean": "~1.0.14",
"bonzo": "~2.0.0",
"bootstrap-sass": "3.4.1",
"browser-sync": "3.0.2",
"bs-fullscreen-message": "^1.1.0",
"btoa": "1.1.2",
"chalk": "^2.1.0",
Expand Down
Loading

0 comments on commit dd183be

Please sign in to comment.