Skip to content

Commit 9476a9a

Browse files
authored
Merge pull request #2193 from nschonni/sourcemap-order
Re-order the sourcemap writing to match spec
2 parents 08ece7d + 12e36dc commit 9476a9a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/source_map.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ namespace Sass {
2525

2626
json_append_member(json_srcmap, "version", json_mknumber(3));
2727

28+
const char *include = file.c_str();
29+
JsonNode *json_include = json_mkstring(include);
30+
json_append_member(json_srcmap, "file", json_include);
31+
2832
// pass-through sourceRoot option
2933
if (!ctx.source_map_root.empty()) {
3034
JsonNode* root = json_mkstring(ctx.source_map_root.c_str());
3135
json_append_member(json_srcmap, "sourceRoot", root);
3236
}
3337

34-
const char *include = file.c_str();
35-
JsonNode *json_include = json_mkstring(include);
36-
json_append_member(json_srcmap, "file", json_include);
37-
3838
JsonNode *json_includes = json_mkarray();
3939
for (size_t i = 0; i < source_index.size(); ++i) {
4040
const char *include = links[source_index[i]].c_str();
@@ -54,15 +54,15 @@ namespace Sass {
5454
json_append_member(json_srcmap, "sourcesContent", json_contents);
5555
}
5656

57-
std::string mappings = serialize_mappings();
58-
JsonNode *json_mappings = json_mkstring(mappings.c_str());
59-
json_append_member(json_srcmap, "mappings", json_mappings);
60-
6157
JsonNode *json_names = json_mkarray();
6258
// so far we have no implementation for names
6359
// no problem as we do not alter any identifiers
6460
json_append_member(json_srcmap, "names", json_names);
6561

62+
std::string mappings = serialize_mappings();
63+
JsonNode *json_mappings = json_mkstring(mappings.c_str());
64+
json_append_member(json_srcmap, "mappings", json_mappings);
65+
6666
char *str = json_stringify(json_srcmap, "\t");
6767
std::string result = std::string(str);
6868
free(str);

0 commit comments

Comments
 (0)