Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
BenSurgisonGDS committed Feb 20, 2023
1 parent 89e270f commit 6142af6
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/dev-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
Expand All @@ -65,7 +65,7 @@ function watchBeforeStarting (options) {
watchSass(appSassDir, options)
}

function watchAfterStarting (options) {
function watchAfterStarting (nodemon) {
plugins.watchPlugins(({ missing, added }) => {
generateAssetsSync()
if (missing.length) {
Expand All @@ -74,7 +74,7 @@ function watchAfterStarting (options) {
if (added.length) {
console.log(`Added ${added.join(', ')}`)
}
options.nodemon.emit('restart')
nodemon.emit('restart')
})
}

Expand Down

0 comments on commit 6142af6

Please sign in to comment.