Skip to content

Commit 97fc236

Browse files
committed
Ignore underscore-prefixed files for scss
1 parent b9702f7 commit 97fc236

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

src/WebCompiler/Compile/SassCompiler.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ public CompilerResult Compile(Config config)
3333
OriginalContent = content,
3434
};
3535

36+
if (config.GlobalMatch)
37+
{
38+
if (string.IsNullOrWhiteSpace(content) || Path.GetFileName(config.InputFile).StartsWith("_"))
39+
return result;
40+
}
41+
3642
try
3743
{
3844
RunCompilerProcess(config, info);

src/WebCompiler/Config/Config.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ public class Config
5555

5656
internal string Output { get; set; }
5757

58+
internal bool GlobalMatch { get; set; }
59+
5860
/// <summary>
5961
/// Converts the relative input file to an absolute file path.
6062
/// </summary>
@@ -224,7 +226,12 @@ Config MakeMatchedConfig(string sourceFile)
224226
internal IEnumerable<Config> Match(string folder)
225227
{
226228
return Directory.EnumerateFiles(folder, this.InputFile, SearchOption.AllDirectories)
227-
.Select(MakeMatchedConfig);
229+
.Select(s =>
230+
{
231+
Config config = MakeMatchedConfig(s);
232+
config.GlobalMatch = true;
233+
return config;
234+
});
228235
}
229236
}
230237
}

src/WebCompiler/Config/ConfigFileProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ private CompilerResult ProcessConfig(string baseFolder, Config config)
203203

204204
var result = compiler.Compile(config);
205205

206-
if (result.Errors.Any(e => !e.IsWarning))
206+
if (result.Errors.Any(e => !e.IsWarning) || string.IsNullOrWhiteSpace(result.CompiledContent))
207207
return result;
208208

209209
if (Path.GetExtension(config.OutputFile).Equals(".css", StringComparison.OrdinalIgnoreCase) && AdjustRelativePaths(config))

0 commit comments

Comments
 (0)