summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scss/__init__.py7
-rw-r--r--scss/tests/files/bugs/at-rules-compressed-semicolon.css1
-rw-r--r--scss/tests/files/bugs/at-rules-compressed-semicolon.scss7
3 files changed, 14 insertions, 1 deletions
diff --git a/scss/__init__.py b/scss/__init__.py
index 26d4fc7..1f1fb91 100644
--- a/scss/__init__.py
+++ b/scss/__init__.py
@@ -1509,6 +1509,10 @@ class Scss(object):
# Close blocks and outdent as necessary
for i in range(len(old_ancestry), first_mismatch, -1):
+ # Possibly skip the last semicolon of the last inner statement
+ if not sc and result and result[-1] == ';':
+ result = result[:-1]
+
result += tb * (i - 1) + '}' + nl
# Open new blocks as necessary
@@ -1540,10 +1544,11 @@ class Scss(object):
if not skip_selectors:
result += self._print_properties(rule.properties, sc, sp, tb * len(ancestry), nl, wrap)
+ # Close all remaining blocks
+ for i in reversed(range(len(old_ancestry))):
if not sc and result and result[-1] == ';':
result = result[:-1]
- for i in reversed(range(len(old_ancestry))):
result += tb * i + '}' + nl
return (result, total_rules, total_selectors)
diff --git a/scss/tests/files/bugs/at-rules-compressed-semicolon.css b/scss/tests/files/bugs/at-rules-compressed-semicolon.css
new file mode 100644
index 0000000..3fac26b
--- /dev/null
+++ b/scss/tests/files/bugs/at-rules-compressed-semicolon.css
@@ -0,0 +1 @@
+@charset "utf8";a{b:c}
diff --git a/scss/tests/files/bugs/at-rules-compressed-semicolon.scss b/scss/tests/files/bugs/at-rules-compressed-semicolon.scss
new file mode 100644
index 0000000..9b1d741
--- /dev/null
+++ b/scss/tests/files/bugs/at-rules-compressed-semicolon.scss
@@ -0,0 +1,7 @@
+@option compress: true;
+
+@charset "utf8";
+
+a {
+ b: c;
+}