Skip to content

Commit

Permalink
Reworks sass include paths
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
phil-scott-78 committed Mar 4, 2017
1 parent 1a9c371 commit e67aeb5
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/extensions/Wyam.Sass/Sass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,16 @@ public IEnumerable<IDocument> Execute(IReadOnlyList<IDocument> 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<string>(_includePaths) { path.Directory.FullPath }.ToArray()
};

SassCompiler sassCompiler = new SassCompiler(sassOptions);
Expand Down

0 comments on commit e67aeb5

Please sign in to comment.