Skip to content

Commit 3cd63a0

Browse files
author
Hampton Catlin
committed
Merge branch 'jlinton-JL_CHANGES't push origin master
2 parents 0576bc5 + f44b8ca commit 3cd63a0

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

context.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ namespace Sass {
211211
{
212212
Block* root = 0;
213213
for (size_t i = 0; i < queue.size(); ++i) {
214-
Parser p(Parser::from_c_str(queue[i].second, *this, queue[i].first, Position(1 + i, 1, 1)));
214+
string parsedata=string(source_c_str)+string("\n")+string(queue[i].second);
215+
Parser p(Parser::from_c_str(parsedata.c_str(), *this, queue[i].first, Position(1 + i, 0, 1)));
215216
Block* ast = p.parse();
216217
if (i == 0) root = ast;
217218
style_sheets[queue[i].first] = ast;

sass_interface.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,14 @@ extern "C" {
190190
else {
191191
output_path = c_ctx->output_path;
192192
}
193+
if (c_ctx->source_string==NULL)
194+
{
195+
c_ctx->source_string="//";
196+
}
193197
Context cpp_ctx(
194-
Context::Data().entry_point(input_path)
198+
199+
Context::Data().source_c_str(c_ctx->source_string)
200+
.entry_point(input_path)
195201
.output_path(output_path)
196202
.output_style((Output_Style) c_ctx->options.output_style)
197203
.source_comments(c_ctx->options.source_comments)

sass_interface.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,12 @@ struct sass_context {
5353
};
5454

5555
struct sass_file_context {
56+
// Input Path is the path to the Sass file for processing
5657
const char* input_path;
5758
const char* output_path;
59+
// Source string is an optional way to inject some Sass before the file is executed
60+
// to allow for dynamic changes in execution w/o a file change.
61+
const char* source_string;
5862
char* output_string;
5963
char* source_map_string;
6064
struct sass_options options;

0 commit comments

Comments
 (0)