Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A second call to ConvertFilesToCss ignores the filename parameter. #20

Closed
leotohill opened this issue Sep 14, 2022 · 2 comments
Closed
Labels

Comments

@leotohill
Copy link

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:

  1. 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
  2. If options.InputFile and the filename parameter to the call specify different non-null values, an exception should be thrown.
@leotohill leotohill changed the title A second call to ConvertFilesToCss ignore the filename parameter. A second call to ConvertFilesToCss ignores the filename parameter. Sep 14, 2022
@xoofx
Copy link
Owner

xoofx commented Sep 15, 2022

PR with test welcome.

@xoofx xoofx added the bug label Sep 15, 2022
xoofx added a commit that referenced this issue Nov 2, 2024
@xoofx
Copy link
Owner

xoofx commented Nov 2, 2024

Fixed by commit 6f7de3c

@xoofx xoofx closed this as completed Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants