def guess_root(file):
'''
For projects without .libsass.json configs, search for the most distant
parent directory that still has a .sass or .scss file
'''
def is_sass(file):
ext = os.path.splitext(file)[1]
return ext in ['.sass', '.scss']
for i, path in enumerate(subpaths(file)):
(_, _, files) = next(os.walk(path))
if not any([is_sass(f) for f in files]):
break
if not is_sass(file):
sublime.error_message("Please save the file")
assert is_sass(file)
assert i > 0
return subpaths(file)[i-1]
评论列表
文章目录