Skip to content

Commit 265ced8

Browse files
committed
Fixes an edge case with compact @font-face output
1 parent 99f60f8 commit 265ced8

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

emitter.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,15 @@ namespace Sass {
3737
bool scheduled_delimiter;
3838

3939
public:
40+
// output strings different in comments
4041
bool in_comment;
42+
// selector list does not get linefeeds
4143
bool in_wrapped;
44+
// lists always get a space after delimiter
4245
bool in_media_block;
46+
// nested list must not have parentheses
4347
bool in_declaration;
48+
// nested lists need parentheses
4449
bool in_space_array;
4550
bool in_comma_array;
4651

inspect.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
#include "inspect.hpp"
2-
#include "ast.hpp"
3-
#include "context.hpp"
4-
#include "utf8/checked.h"
51
#include <cmath>
62
#include <string>
73
#include <iostream>
84
#include <iomanip>
95
#include <stdint.h>
106
#include <stdint.h>
117

8+
#include "ast.hpp"
9+
#include "inspect.hpp"
10+
#include "context.hpp"
11+
#include "utf8/checked.h"
12+
1213
namespace Sass {
1314
using namespace std;
1415

@@ -99,9 +100,10 @@ namespace Sass {
99100
append_token(at_rule->keyword(), at_rule);
100101
if (at_rule->selector()) {
101102
append_mandatory_space();
103+
bool was_wrapped = in_wrapped;
102104
in_wrapped = true;
103105
at_rule->selector()->perform(this);
104-
in_wrapped = false;
106+
in_wrapped = was_wrapped;
105107
}
106108
if (at_rule->block()) {
107109
at_rule->block()->perform(this);

output.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,19 +349,21 @@ namespace Sass {
349349

350350
append_scope_opener();
351351

352+
bool format = kwd != "@font-face";;
353+
352354
for (size_t i = 0, L = b->length(); i < L; ++i) {
353355
Statement* stm = (*b)[i];
354356
if (!stm->is_hoistable()) {
355357
stm->perform(this);
356-
if (i < L - 1) append_special_linefeed();
358+
if (i < L - 1 && format) append_special_linefeed();
357359
}
358360
}
359361

360362
for (size_t i = 0, L = b->length(); i < L; ++i) {
361363
Statement* stm = (*b)[i];
362364
if (stm->is_hoistable()) {
363365
stm->perform(this);
364-
if (i < L - 1) append_special_linefeed();
366+
if (i < L - 1 && format) append_special_linefeed();
365367
}
366368
}
367369

0 commit comments

Comments
 (0)