Skip to content

Commit 18e74c2

Browse files
committed
feat(watches): add additional assets to ignore
1 parent 8f6cd91 commit 18e74c2

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

packages/core/src/lib/watchAssets.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,24 @@ const watchAssets = (
2929
watchOnce
3030
) => {
3131
const assetBase = path.resolve(basePath, dir.source);
32+
const assetsToIgnore = patternlab.config.transformedAssetTypes
33+
? patternlab.config.transformedAssetTypes.join('|')
34+
: '';
3235
logger.debug(`Pattern Lab is watching ${assetBase} for changes`);
3336

3437
if (patternlab.watchers[key]) {
3538
patternlab.watchers[key].close();
3639
}
3740
const assetWatcher = chokidar.watch(assetBase, {
38-
ignored: /(^|[\/\\])\../,
41+
// *ignored* combines file types that the wrapper is watching, passed to pl config
42+
// regex string escapes backslashes for JS
43+
// second part of regex is holdover from existing ignore regex for '/index.html' and other
44+
// files meant to be ignored, not based on file type
45+
ignored: new RegExp(
46+
`(?:(?:.*\\.(?:${assetsToIgnore})$)|(?:(^|[\\/\\\\])\\..))`,
47+
'i'
48+
),
49+
// ignored: /(^|[\/\\])\../, //old version
3950
ignoreInitial: false,
4051
awaitWriteFinish: {
4152
stabilityThreshold: 200,

0 commit comments

Comments
 (0)