ability to parse more complex directives

This commit is contained in:
cloudhead 2010-02-25 21:29:21 -05:00
parent 3d60c12a68
commit 3f753da627

View File

@ -378,12 +378,17 @@ less.parser = {
} }
}, },
directive: function directive(root) { directive: function directive(root) {
var name, value, rules; var name, value, rules, types;
if (input[i] !== '@') return; if (input[i] !== '@') return;
if (name = $(/@[a-z]+/g)) { if (name = $(/@media|@page/g)) {
if (name === '@media' || name === '@font-face') { types = $(/[a-z:, ]+/g);
if (rules = $(this.block, root)) {
return new(node.Directive)(name + " " + types, rules);
}
} else if (name = $(/@[-a-z]+/g)) {
if (name === '@font-face') {
if (rules = $(this.block, root)) { if (rules = $(this.block, root)) {
return new(node.Directive)(name, rules); return new(node.Directive)(name, rules);
} }