diff --git a/djlint/settings.py b/djlint/settings.py index 64bd62a0..6f34d7ca 100644 --- a/djlint/settings.py +++ b/djlint/settings.py @@ -1125,7 +1125,7 @@ def __init__( ) def get_resolved_exclude_paths(self) -> list[Path]: - exclude_paths = [] - for p in self.exclude.split("|"): - exclude_paths.append(Path(p.strip().replace("\\.", ".")).resolve()) - return exclude_paths + return [ + Path(p.strip().replace("\\.", ".")).resolve() + for p in self.exclude.split("|") + ] diff --git a/djlint/src.py b/djlint/src.py index 106b7672..5a91485b 100644 --- a/djlint/src.py +++ b/djlint/src.py @@ -44,9 +44,9 @@ def get_src(src: Iterable[Path], config: Config) -> list[Path]: paths.extend( x for x in normalized_item.glob(f"**/*.{extension}") - if not any([ + if not any( x.is_relative_to(p) for p in config.get_resolved_exclude_paths() - ]) + ) and no_pragma(config, x) and ( (config.use_gitignore and not config.gitignore.match_file(x))