sassw: fix watching over sources

This commit is contained in:
Frédéric Péters 2021-01-17 19:48:32 +01:00
parent 80526c0055
commit 8e4427dae6
1 changed files with 3 additions and 1 deletions

View File

@ -26,6 +26,7 @@ else:
def build():
global sources, directories
directories = set()
sources = set()
for filename in filenames:
result = subprocess.run(
['sassc', '-mauto', filename, filename.replace('.scss', '.css')],
@ -43,7 +44,8 @@ def build():
}''' % result.stderr.replace('\n', '\\A').replace('"', '\\"'),
file=fd)
basepath = os.path.abspath(os.path.dirname(filename))
sources = [os.path.abspath(os.path.join(basepath, x)) for x in json.load(open(filename.replace('.scss', '.css.map')))['sources']]
sources = sources.union(set([os.path.abspath(os.path.join(basepath, x))
for x in json.load(open(filename.replace('.scss', '.css.map')))['sources']]))
directories = directories.union(set([os.path.dirname(x) for x in sources]))
class EventManager(pyinotify.ProcessEvent):