Skip to content

Commit

Permalink
Merge pull request sass#251 from svnieuw/sourcemaps
Browse files Browse the repository at this point in the history
Fix issue sass#217: wrong file property value in source map.
  • Loading branch information
Aaron Leung committed Jan 15, 2014
2 parents 1b564b6 + 77de2b0 commit 4a87734
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace Sass {
include_paths (initializers.include_paths()),
queue (vector<pair<string, const char*> >()),
style_sheets (map<string, Block*>()),
source_map(File::base_name(initializers.entry_point())),
source_map(File::base_name(initializers.output_path())),
image_path (initializers.image_path()),
source_comments (initializers.source_comments()),
source_maps (initializers.source_maps()),
Expand Down Expand Up @@ -249,7 +249,7 @@ namespace Sass {
{
if (!source_maps) return 0;
char* result = 0;
string map = source_map.generate_source_map(this);
string map = source_map.generate_source_map();
result = copy_c_str(map.c_str());
return result;
}
Expand Down
1 change: 1 addition & 0 deletions context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ namespace Sass {
KWD_ARG_SET(Data) {
KWD_ARG(Data, const char*, source_c_str);
KWD_ARG(Data, string, entry_point);
KWD_ARG(Data, string, output_path);
KWD_ARG(Data, string, image_path);
KWD_ARG(Data, const char*, include_paths_c_str);
KWD_ARG(Data, const char**, include_paths_array);
Expand Down
2 changes: 2 additions & 0 deletions sass_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,10 @@ extern "C" {
source_maps = true;
source_map_file = c_ctx->source_map_file;
}
string output_path = c_ctx->output_path ? c_ctx->output_path : "";
Context cpp_ctx(
Context::Data().entry_point(c_ctx->input_path)
.output_path(output_path)
.output_style((Output_Style) c_ctx->options.output_style)
.source_comments(c_ctx->options.source_comments == SASS_SOURCE_COMMENTS_DEFAULT)
.source_maps(source_maps)
Expand Down
1 change: 1 addition & 0 deletions sass_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ struct sass_context {

struct sass_file_context {
const char* input_path;
const char* output_path;
char* output_string;
char* source_map_string;
const char* source_map_file;
Expand Down
2 changes: 1 addition & 1 deletion source_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Sass {

SourceMap::SourceMap(const string& file) : current_position(Position(1, 1)), file(file) { }

string SourceMap::generate_source_map(Context* ctx) {
string SourceMap::generate_source_map() {
string result = "{\n";
result += " \"version\": 3,\n";
result += " \"file\": \"" + file + "\",\n";
Expand Down
2 changes: 1 addition & 1 deletion source_map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace Sass {
void update_column();
void add_mapping(AST_Node* node);

string generate_source_map(Context* ctx);
string generate_source_map();

private:

Expand Down

0 comments on commit 4a87734

Please sign in to comment.