Fix all scss files rebuild on every non-js change

multimatch test was incorrect triggering scss rebuild on every change
that reached that logic.

Also fixed weird (legacy?) use of path.join()
This commit is contained in:
Tom Najdek 2022-05-25 15:10:30 +02:00
parent c2ce5c7596
commit 32c0d228cc
No known key found for this signature in database
GPG key ID: EEC61A7B4C667D77
2 changed files with 3 additions and 3 deletions

View file

@ -33,13 +33,13 @@ async function getSass(source, options, signatures={}) {
let newFileSignature = await getFileSignature(f);
let destFile = getPathRelativeTo(f, 'scss');
destFile = path.join(path.dirname(destFile), path.basename(destFile, '.scss') + '.css');
let dest = path.join.apply(this, ['build', 'chrome', 'skin', 'default', 'zotero', destFile]);
let dest = path.join('build', 'chrome', 'skin', 'default', 'zotero', destFile);
if (['win', 'mac', 'unix'].some(platform => f.endsWith(`-${platform}.scss`))) {
let platform = f.slice(f.lastIndexOf('-') + 1, f.lastIndexOf('.'));
destFile = destFile.slice(0, destFile.lastIndexOf('-'))
+ destFile.slice(destFile.lastIndexOf('-') + 1 + platform.length);
dest = path.join.apply(this, ['build', 'chrome', 'content', 'zotero-platform', platform, destFile]);
dest = path.join('build', 'chrome', 'content', 'zotero-platform', platform, destFile);
}
try {

View file

@ -56,7 +56,7 @@ function getWatch() {
return;
}
for (var i = 0; i < scssFiles.length; i++) {
if (multimatch(path, scssFiles[i])) {
if (multimatch(path, scssFiles[i]).length) {
onSuccess(await getSass(scssFiles[i], { ignore: ignoreMask }));
onSuccess(await cleanUp(signatures));
return;