Transform Sass asset file extensions in block.json #430
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.
Related Issue/RFC: #419
Description of the Change
When a Sass file is used as a custom block asset, and the asset is set to a
.css
file in block.json, an error is thrown related to automatic version string generation because a file with that name and extension are not available in the source folder.This PR duplicates the existing functionality that transforms TypeScript asset extensions in block.json for Sass files (.sass/.scss => .css).
block.json input:
block.json output:
Alternate Designs
I could have changed the way that the version string generator works, but that is much less straightforward than just providing the file that the existing code is looking for (while also following the existing example set by the treatment of TypeScript files).
Possible Drawbacks
I realize that 10up seems to be moving away from Sass, but the workflow still inherently supports it.
A possible, but tiny, drawback is that this will likely change the generated version string in existing projects.
Verification Process
I verified the fix by running
npm start
in an existing project where I discovered the original issue. I also added and ran the tests successfully.Checklist: