Conversation
The bundle already finds .sass files, since resolveSassInput() does not look at extensions, and Dart Sass compiles both. Only the translation of a Sass path into its .css counterpart was written for .scss alone, so a .sass file was served under its own name and never resolved. The three places that did the translation now share isSassFile() and stripSassExtension() on SassFileHelper.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #83
The bundle already finds
.sassfiles:SassFileHelper::resolveSassInput()never looks at extensions, and Dart Sass compiles both syntaxes. What was written for.scssalone is the translation of a Sass path into its.csscounterpart, so a.sassfile was served under its own name and never resolved, which is what @WossomGonzo ran into.Three places did that translation and now share
isSassFile()andstripSassExtension()onSassFileHelper:SassPublicPathAssetPathResolver::resolvePublicPath()SassPublicPathAssetPathResolver::getPublicFilesystemPath()SassBuilder::guessCssNameFromSassFile()The old
substr($path, 0, -5)happened to be right for both extensions, since.scssand.sassare the same length. The helper cuts the extension it actually matched instead.Five cases cover the helpers, including two guards: a
.cssfile is not Sass, and a directory named.scss/does not trigger the translation, which the originalstr_ends_withwas already careful about.The doc only ever mentioned
.scss, so it now says both work.Three reds are already there on
mainand are untouched by this:SassBuilderTest::testSearchForBinarywants a real sass binary, PHPStan reports five errors inCommand/SassBuildCommand.php, and php-cs-fixer wants to reformat two test files.