SharpScss
SharpScss copied to clipboard
A second call to ConvertFilesToCss ignores the filename parameter.
Repro with this Powershell
Add-Type -AssemblyName (Join-Path $runFolder "SharpScss.dll")
$options = new-object SharpScss.ScssOptions
$options.OutputStyle = [SharpScss.ScssOutputStyle] "Expanded"
$r1= [SharpScss.Scss]::ConvertFileToCss("file1.css", $options)
# the next line does NOT compile file2.css. It compiles file1.css.
$r2= [SharpScss.Scss]::ConvertFileToCss("file2.css", $options)
The cause of the problem is that the first call had options.InputFile set to null, and SharpScss changed that value to "file1.css". Then the second call was specifying the filename in two ways: options.InputFile and the filename parameter to the call. SharpCss chose the options.FIleName value instead of the parameter value.
IMO:
- SharpScss should not change values in the Options object. If it needs to do so for internal convenience, it should clone the options and modify the clone
- If options.InputFile and the filename parameter to the call specify different non-null values, an exception should be thrown.
PR with test welcome.