Permalink
Browse files

Support windows full paths in imports. Fixes #177.

  • Loading branch information...
1 parent ce66cdf commit 75e058f2ceeefe88f857bb97180c889e824f654e @lukeapage lukeapage committed Apr 27, 2012
Showing with 21 additions and 1 deletion.
  1. +1 −1 src/dotless.Core/Importers/Importer.cs
  2. +20 −0 src/dotless.Test/Specs/ImportFixture.cs
@@ -63,7 +63,7 @@ public Importer(IFileReader fileReader, bool disableUrlReWriting, bool inlineCss
/// </summary>
private static bool IsProtocolUrl(string url)
{
- return Regex.IsMatch(url, @"^([a-zA-Z]+:)");
+ return Regex.IsMatch(url, @"^([a-zA-Z]{2,}:)");
}
/// <summary>
@@ -20,6 +20,11 @@ private static Parser GetParser(bool isUrlRewritingDisabled, bool importAllFiles
@import ""import-test-b.less"";
@a: 20%;
";
+ imports[@"c:/absolute/file.less"] = @"
+.windowz .dos {
+ border: none;
+}
+";
imports["import/other-protocol-test.less"] = @"
.first {
background-image: url('http://some.com/file.gif');
@@ -180,6 +185,21 @@ public void OtherProtocolImportTest2()
Assert.AreEqual(0, dictionaryReader.GetFileContentsCalls.Count, "We should not ask the file reader if a protocol file exists");
}
+ [Test]
+ public void OtherProtocolImportTest3()
+ {
+ var input = @"
+@import url('c:/absolute/file.less');";
+ var expected = @"
+.windowz .dos {
+ border: none;
+}
+";
+ var parser = GetParser();
+
+ AssertLess(input, expected, parser);
+ }
+
[Test]
public void RelativeUrls()
{

0 comments on commit 75e058f

Please sign in to comment.