Skip to content

Commit 5c57985

Browse files
Support comments after @import statements
Fixed #215
1 parent a47a6d0 commit 5c57985

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/WebCompiler/Dependencies/SassDependencyResolver.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public override void UpdateFileDependencies(string path)
5050
string content = File.ReadAllText(info.FullName);
5151

5252
//match both <@import "myFile.scss";> and <@import url("myFile.scss");> syntax
53-
var matches = Regex.Matches(content, @"(?<=^@import(?:[\s]+))(?:(?:\(\w+\)))?\s*(?:url)?(?<url>.+?)$", RegexOptions.Multiline);
53+
var matches = Regex.Matches(content, @"(?<=^@import(?:[\s]+))(?:(?:\(\w+\)))?\s*(?:url)?(?<url>[^;]+)", RegexOptions.Multiline);
5454
foreach (Match match in matches)
5555
{
5656
var importedfiles = GetFileInfos(info, match);

src/WebCompilerTest/artifacts/scss/test.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import "variables", "sub/foo";
1+
@import "variables", "sub/foo"; // Bootstrap overrides
22

33
body {
44
background-color: $background;

0 commit comments

Comments
 (0)