Commit 8c8f022e by Aaron Leung

Working on interpolated imports.

parent c7f07857
......@@ -62,12 +62,24 @@ namespace Sass {
lex< import >();
if (lex< uri_prefix >())
{
const char* beg = position;
const char* end = find_first< exactly<')'> >(position);
Node result(Node::css_import, line_number, Token::make(beg, end));
position = end;
lex< exactly<')'> >();
return result;
if (peek< string_constant >()) {
Node schema(parse_string());
Node import(Node::css_import, context.registry, line_number, 1);
import << schema;
if (!lex< exactly<')'> >()) syntax_error("unterminated url in @import directive");
return import;
}
else {
const char* beg = position;
const char* end = find_first< exactly<')'> >(position);
if (!end) syntax_error("unterminated url in @import directive");
Node path(Node::identifier, line_number, Token::make(beg, end));
Node import(Node::css_import, context.registry, line_number, 1);
import << path;
position = end;
lex< exactly<')'> >();
return import;
}
}
if (!lex< string_constant >()) syntax_error("@import directive requires a url or quoted path");
// TO DO: BETTER PATH HANDLING
......
......@@ -257,6 +257,11 @@ namespace Sass {
return expr;
} break;
case Node::css_import: {
expr[0] = eval(expr[0], env, f_env, registry);
return expr;
} break;
default: {
return expr;
}
......
......@@ -178,7 +178,7 @@ namespace Sass {
case css_import: {
stringstream ss;
ss << "@import url(";
ss << content.token.to_string();
ss << at(0).to_string("");
// cerr << content.token.to_string() << endl;
ss << ")";
return ss.str();
......@@ -418,7 +418,7 @@ namespace Sass {
}
for (size_t i = 0; i < size(); ++i) {
at(i).emit_nested_css(buf, depth, prefixes);
if (at(i).type == css_import) buf << endl;
//if (at(i).type == css_import) buf << endl;
}
break;
......@@ -494,9 +494,9 @@ namespace Sass {
break;
case css_import:
buf << endl << string(2*depth, ' ');
buf << string(2*depth, ' ');
buf << to_string("");
buf << ";";
buf << ";" << endl;
break;
case property:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment