Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions sass_processor/management/commands/compilescss.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ def add_arguments(self, parser):
help=_(
"Set the precision for numeric computations in the SASS processor. Default: settings.SASS_PRECISION.")
)
parser.add_argument(
'--exclude-py',
action='store_true',
dest='exclude_py',
default=False,
help=_("Exclude python files from scan?")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: perhaps change question mark to dot.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather, no punctuation mark at all.

)

def get_loaders(self):
template_source_loaders = []
Expand Down Expand Up @@ -146,18 +153,19 @@ def handle(self, *args, **options):

self.processed_files = []

# find all Python files making up this project; They might invoke `sass_processor`
for py_source in self.find_sources():
if self.verbosity > 1:
self.stdout.write("Parsing file: %s" % py_source)
elif self.verbosity == 1:
self.stdout.write(".", ending="")
try:
self.parse_source(py_source)
except (SyntaxError, IndentationError) as e:
self.stderr.write("Syntax error encountered processing %s" % py_source)
self.stderr.write("Aborting compilation")
raise
if not options['exclude_py']:
# find all Python files making up this project; They might invoke `sass_processor`
for py_source in self.find_sources():
if self.verbosity > 1:
self.stdout.write("Parsing file: %s" % py_source)
elif self.verbosity == 1:
self.stdout.write(".", ending="")
try:
self.parse_source(py_source)
except SyntaxError as e:
self.stderr.write("Syntax error encountered processing %s" % py_source)
self.stderr.write("Aborting compilation")
raise

# find all Django/Jinja2 templates making up this project; They might invoke `sass_src`
templates = self.find_templates()
Expand Down