diff --git a/lib/dev-server.js b/lib/dev-server.js index cefb3d0564..3549b75085 100644 --- a/lib/dev-server.js +++ b/lib/dev-server.js @@ -34,28 +34,28 @@ async function runDevServer () { const watchOptions = {} - watchBeforeStarting(watchOptions) - watchOptions.nodemon = await runNodemon(port) - watchAfterStarting(watchOptions) + watchBeforeStarting() + const nodemon = await runNodemon(port) + watchAfterStarting(nodemon) } -function processSass (fullFilename, options) { +function processSass (fullFilename) { const filename = fullFilename.split('/').pop().toLowerCase() if (filename === 'settings.scss') { proxyUserSassIfItExists(filename) - options.nodemon.emit('restart') + generateCssSync() } } -function watchSass (sassPath, options) { +function watchSass (sassPath) { if (!fse.existsSync(sassPath)) return chokidar.watch(sassPath, { ignoreInitial: true, disableGlobbing: true // Prevents square brackets from being mistaken for globbing characters }).on('add', (filename) => { - processSass(filename, options) + processSass(filename) }).on('unlink', (filename) => { - processSass(filename, options) + processSass(filename) }).on('all', () => { generateCssSync() }) @@ -65,7 +65,7 @@ function watchBeforeStarting (options) { watchSass(appSassDir, options) } -function watchAfterStarting (options) { +function watchAfterStarting (nodemon) { plugins.watchPlugins(({ missing, added }) => { generateAssetsSync() if (missing.length) { @@ -74,7 +74,7 @@ function watchAfterStarting (options) { if (added.length) { console.log(`Added ${added.join(', ')}`) } - options.nodemon.emit('restart') + nodemon.emit('restart') }) }