From e67aeb541d7432113dfdeefc4ae3caabee80fb63 Mon Sep 17 00:00:00 2001 From: Phil Date: Fri, 3 Mar 2017 23:35:44 -0500 Subject: [PATCH] Reworks sass include paths Original code was modifying the class level list on each run in parallel. Not smart. This creates a new array if it is needed rather than adding to the class level instance. --- src/extensions/Wyam.Sass/Sass.cs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/extensions/Wyam.Sass/Sass.cs b/src/extensions/Wyam.Sass/Sass.cs index b8f79f64e..b0f42cca6 100644 --- a/src/extensions/Wyam.Sass/Sass.cs +++ b/src/extensions/Wyam.Sass/Sass.cs @@ -116,19 +116,16 @@ public IEnumerable Execute(IReadOnlyList inputs, IExecutio return inputs.AsParallel().Select(context, input => { Trace.Verbose("Processing Sass for {0}", input.SourceString()); - - FilePath path = input.FilePath(Keys.SourceFilePath); - if (path != null) - { - _includePaths.Add(path.Directory.FullPath); - } + FilePath path = input.FilePath(Keys.SourceFilePath); SassOptions sassOptions = new SassOptions - { + { Data = input.Content, - IncludePaths = _includePaths.ToArray(), IncludeSourceComments = _includeSourceComments, - OutputStyle = _outputStyle + OutputStyle = _outputStyle, + IncludePaths = path == null + ? _includePaths.ToArray() + : new List(_includePaths) { path.Directory.FullPath }.ToArray() }; SassCompiler sassCompiler = new SassCompiler(sassOptions);