From bad53ddec42b27952e51bfc50ef951eaa60500f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Fri, 23 Aug 2019 11:56:18 +0200 Subject: [PATCH] sassw: accept directory as parameter --- bin/sassw | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/sassw b/bin/sassw index e580f02..f936346 100755 --- a/bin/sassw +++ b/bin/sassw @@ -7,6 +7,7 @@ # (output will automatically be INPUT with .scss changed to .css) import json +import glob import os import pyinotify import subprocess @@ -14,6 +15,11 @@ import sys import time filename = sys.argv[1] +if os.path.isdir(filename): + scss_filenames = [x for x in os.listdir(filename) if x.startswith('_') and x.endswith('.scss')] + if not scss_filenames: + print('Error: directory specified but no proper scss file within.', file=sys.stderr) + filename = os.path.join(filename, scss_filenames[0]) def build(): global sources, directories