Skip to content

Commit d15d5df

Browse files
Updated regex
Fixed #180
1 parent aa6a7f7 commit d15d5df

File tree

8 files changed

+9
-9
lines changed

8 files changed

+9
-9
lines changed

src/WebCompiler/Dependencies/SassDependencyResolver.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ public override void UpdateFileDependencies(string path)
4949
string content = File.ReadAllText(info.FullName);
5050

5151
//match both <@import "myFile.scss";> and <@import url("myFile.scss");> syntax
52-
var matches = System.Text.RegularExpressions.Regex.Matches(content, "@import\\s+(url\\()?(['\"])(.*?)(\\2)\\)?;");
52+
var matches = System.Text.RegularExpressions.Regex.Matches(content, "@import([\\s]+)(\\([\\S]+\\)([\\s]+))?(url\\()?('|\"|)(?<url>[^'\"\\)]+)('|\"|\\))");
5353
foreach (System.Text.RegularExpressions.Match match in matches)
5454
{
55-
FileInfo importedfile = new FileInfo(Path.Combine(info.DirectoryName, match.Groups[3].Value));
55+
FileInfo importedfile = new FileInfo(Path.Combine(info.DirectoryName, match.Groups["url"].Value));
5656
//if the file doesn't end with the correct extension, an import statement without extension is probably used, to re-add the extension (#175)
5757
if (string.Compare(importedfile.Extension, FileExtension, StringComparison.OrdinalIgnoreCase) != 0)
5858
{

src/WebCompiler/MSBuild/CompilerBuildTask.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public override bool Execute()
5757

5858
foreach (var error in result.Errors)
5959
{
60-
Log.LogError("WebCompiler", "0", "", error.FileName, error.LineNumber, error.ColumnNumber, error.LineNumber, error.ColumnNumber, error.Message, null); ;
60+
Log.LogError("WebCompiler", "0", "", error.FileName, error.LineNumber, error.ColumnNumber, error.LineNumber, error.ColumnNumber, error.Message, null);
6161
}
6262
}
6363
}

src/WebCompilerVsix/Commands/CleanOutputFiles.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ private CleanOutputFiles(Package package)
1717
{
1818
if (package == null)
1919
{
20-
throw new ArgumentNullException("package");
20+
throw new ArgumentNullException(nameof(package));
2121
}
2222

2323
_package = package;

src/WebCompilerVsix/Commands/CompileAllFiles.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ private CompileAllFiles(Package package)
1717
{
1818
if (package == null)
1919
{
20-
throw new ArgumentNullException("package");
20+
throw new ArgumentNullException(nameof(package));
2121
}
2222

2323
_package = package;

src/WebCompilerVsix/Commands/CompileOnBuild.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ private CompileOnBuild(Package package)
2121
{
2222
if (package == null)
2323
{
24-
throw new ArgumentNullException("package");
24+
throw new ArgumentNullException(nameof(package));
2525
}
2626

2727
_package = package;

src/WebCompilerVsix/Commands/CreateConfig.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ private CreateConfig(Package package)
1818
{
1919
if (package == null)
2020
{
21-
throw new ArgumentNullException("package");
21+
throw new ArgumentNullException(nameof(package));
2222
}
2323

2424
_package = package;

src/WebCompilerVsix/Commands/Recompile.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ private Recompile(Package package)
1515
{
1616
if (package == null)
1717
{
18-
throw new ArgumentNullException("package");
18+
throw new ArgumentNullException(nameof(package));
1919
}
2020

2121
_package = package;

src/WebCompilerVsix/Commands/RemoveConfig.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ private RemoveConfig(Package package)
1717
{
1818
if (package == null)
1919
{
20-
throw new ArgumentNullException("package");
20+
throw new ArgumentNullException(nameof(package));
2121
}
2222

2323
_package = package;

0 commit comments

Comments
 (0)