From 298ecf7da7fee9c7840f8c6d02e91621c7e314b9 Mon Sep 17 00:00:00 2001 From: MurakamiShinyu Date: Mon, 22 Mar 2021 19:08:44 +0900 Subject: [PATCH 1/2] fix: Preview watch not refreshed when CSS file is changed This is a follow-up fix of https://github.com/vivliostyle/vivliostyle-cli/pull/149. --- src/commands/preview.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/commands/preview.ts b/src/commands/preview.ts index 889d5f4b..72dd1fbc 100644 --- a/src/commands/preview.ts +++ b/src/commands/preview.ts @@ -127,11 +127,13 @@ export default async function preview(cliFlags: PreviewCliFlags) { return true; // ignore md or html files not in entries source } if ( - config.themeIndexes.find((theme) => - theme.type === 'file' - ? path === theme.destination - : theme.type === 'package' && - pathStartsWith(path, theme.destination), + config.themeIndexes.find( + (theme) => + (theme as any).destination !== theme.location && + (theme.type === 'file' + ? path === theme.destination + : theme.type === 'package' && + pathStartsWith(path, theme.destination)), ) ) { return true; // ignore copied theme files From 18c0a9329fcc06e7ca1a75619433b169408966c5 Mon Sep 17 00:00:00 2001 From: MurakamiShinyu Date: Sat, 27 Mar 2021 17:31:40 +0900 Subject: [PATCH 2/2] refactor: Don't use `as any` --- src/commands/preview.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/commands/preview.ts b/src/commands/preview.ts index 72dd1fbc..4e4eddb0 100644 --- a/src/commands/preview.ts +++ b/src/commands/preview.ts @@ -129,11 +129,11 @@ export default async function preview(cliFlags: PreviewCliFlags) { if ( config.themeIndexes.find( (theme) => - (theme as any).destination !== theme.location && + (theme.type === 'file' || theme.type === 'package') && + theme.destination !== theme.location && (theme.type === 'file' ? path === theme.destination - : theme.type === 'package' && - pathStartsWith(path, theme.destination)), + : pathStartsWith(path, theme.destination)), ) ) { return true; // ignore copied theme files