Skip to content

[heft-sass-plugin] Add doNotTrimOriginalFileExtension option#5755

Open
iclanton wants to merge 6 commits intomicrosoft:mainfrom
iclanton:sass-doNotTrimOriginalFileExtension
Open

[heft-sass-plugin] Add doNotTrimOriginalFileExtension option#5755
iclanton wants to merge 6 commits intomicrosoft:mainfrom
iclanton:sass-doNotTrimOriginalFileExtension

Conversation

@iclanton
Copy link
Copy Markdown
Member

@iclanton iclanton commented Apr 8, 2026

Summary

Adds a doNotTrimOriginalFileExtension option to heft-sass-plugin. When enabled, the original source file extension is preserved in the CSS output filename. For example, styles.scss emits styles.scss.css instead of styles.css.

Details

Previously, the plugin always stripped the original extension before appending .css, so styles.module.scss would produce styles.module.css. Some consumers need the original extension retained in the output path (e.g. to avoid filename collisions when multiple input extensions map to the same base name, or to match an expected import path convention).

The option is wired through ISassConfigurationJson in SassPlugin.tsISassProcessorOptions in SassProcessor.ts, where the branching logic in CSS output path generation was already added.

A new build-test project (heft-sass-doNotTrimOriginalFileExtension-test) exercises the option end-to-end: it configures doNotTrimOriginalFileExtension: true and uses Jest snapshot tests to assert that the CSS output files carry the original extension (e.g. styles.module.scss.css, stylesGlobal.global.scss.css).

How it was tested

The new heft-sass-doNotTrimOriginalFileExtension-test build-test project will be built as part of CI. Snapshots will be committed after the initial build to lock in the expected output filenames.

iclanton and others added 5 commits April 7, 2026 17:43
- Add the option to the JSON schema and sass.json template
- Wire it through SassPlugin's ISassConfigurationJson and sassProcessorOptions
- Add heft-sass-doNotTrimOriginalFileExtension-test build-test project to verify CSS output files retain the original extension (e.g. styles.module.scss.css)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs triage

Development

Successfully merging this pull request may close these issues.

3 participants