Skip to content

Commit 2971ae6

Browse files
iclantonclaude
andauthored
[heft-sass-plugin] Add doNotTrimOriginalFileExtension option (#5755)
* Add doNotTrimOriginalFileExtension option to heft-sass-plugin - 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> * Add .gitignore for heft-sass-doNotTrimOriginalFileExtension-test Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fixup! Add doNotTrimOriginalFileExtension option to heft-sass-plugin * Rush update. * Add rush change file for heft-sass-plugin doNotTrimOriginalFileExtension Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fixup! Add doNotTrimOriginalFileExtension option to heft-sass-plugin --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e58b6a6 commit 2971ae6

20 files changed

Lines changed: 307 additions & 10 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ These GitHub repositories provide supplementary resources for Rush Stack:
201201
| [/build-tests/heft-parameter-plugin](./build-tests/heft-parameter-plugin/) | This project contains a Heft plugin that adds a custom parameter to built-in actions |
202202
| [/build-tests/heft-parameter-plugin-test](./build-tests/heft-parameter-plugin-test/) | This project exercises a built-in Heft action with a custom parameter |
203203
| [/build-tests/heft-rspack-everything-test](./build-tests/heft-rspack-everything-test/) | Building this project tests every task and config file for Heft when targeting the web browser runtime using Rspack |
204+
| [/build-tests/heft-sass-doNotTrimOriginalFileExtension-test](./build-tests/heft-sass-doNotTrimOriginalFileExtension-test/) | Tests the doNotTrimOriginalFileExtension option for heft-sass-plugin |
204205
| [/build-tests/heft-sass-test](./build-tests/heft-sass-test/) | This project illustrates a minimal tutorial Heft project targeting the web browser runtime |
205206
| [/build-tests/heft-swc-test](./build-tests/heft-swc-test/) | Building this project tests building with SWC |
206207
| [/build-tests/heft-typescript-composite-test](./build-tests/heft-typescript-composite-test/) | Building this project tests behavior of Heft when the tsconfig.json file uses project references. |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lib-css
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/heft/v0/heft.schema.json",
3+
4+
"phasesByName": {
5+
"build": {
6+
"cleanFiles": [{ "includeGlobs": ["lib-commonjs", "lib-css", "temp"] }],
7+
8+
"tasksByName": {
9+
"sass": {
10+
"taskPlugin": {
11+
"pluginPackage": "@rushstack/heft-sass-plugin"
12+
}
13+
},
14+
"typescript": {
15+
"taskDependencies": ["sass"],
16+
"taskPlugin": {
17+
"pluginPackage": "@rushstack/heft-typescript-plugin"
18+
}
19+
}
20+
}
21+
},
22+
23+
"test": {
24+
"phaseDependencies": ["build"],
25+
"tasksByName": {
26+
"jest": {
27+
"taskPlugin": {
28+
"pluginPackage": "@rushstack/heft-jest-plugin"
29+
}
30+
}
31+
}
32+
}
33+
}
34+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "@rushstack/heft-jest-plugin/includes/jest-shared.config.json",
3+
4+
"roots": ["<rootDir>/lib-commonjs"],
5+
"testMatch": ["<rootDir>/lib-commonjs/**/*.test.{cjs,js}"]
6+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush-project.schema.json",
3+
4+
"operationSettings": [
5+
{
6+
"operationName": "_phase:build",
7+
"outputFolderNames": ["lib-commonjs", "lib-css", "temp/sass-ts"]
8+
},
9+
{
10+
"operationName": "_phase:test",
11+
"outputFolderNames": ["coverage"]
12+
}
13+
]
14+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/heft/v0/heft-sass-plugin.schema.json",
3+
4+
"cssOutputFolders": ["lib-css"],
5+
"fileExtensions": [".module.scss"],
6+
"nonModuleFileExtensions": [".global.scss"],
7+
"doNotTrimOriginalFileExtension": true,
8+
"silenceDeprecations": ["mixed-decls", "import", "global-builtin", "color-functions"]
9+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "heft-sass-doNotTrimOriginalFileExtension-test",
3+
"description": "Tests the doNotTrimOriginalFileExtension option for heft-sass-plugin",
4+
"version": "1.0.0",
5+
"private": true,
6+
"scripts": {
7+
"build": "heft build --clean",
8+
"_phase:build": "heft run --only build -- --clean",
9+
"_phase:test": "heft run --only test -- --clean"
10+
},
11+
"devDependencies": {
12+
"@rushstack/heft": "workspace:*",
13+
"@rushstack/heft-jest-plugin": "workspace:*",
14+
"@rushstack/heft-sass-plugin": "workspace:*",
15+
"@rushstack/heft-typescript-plugin": "workspace:*",
16+
"@types/heft-jest": "1.0.1",
17+
"@types/node": "20.17.19",
18+
"typescript": "~5.8.2"
19+
}
20+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* Test SCSS module for verifying doNotTrimOriginalFileExtension output.
3+
* Expected output: styles.module.scss.css (not styles.module.css)
4+
*/
5+
6+
.label {
7+
color: royalblue;
8+
}
9+
10+
.container {
11+
padding: 16px;
12+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* Test non-module SCSS for verifying doNotTrimOriginalFileExtension output.
3+
* Expected output: stylesGlobal.global.scss.css (not stylesGlobal.global.css)
4+
*/
5+
6+
.globalWrapper {
7+
font-size: 16px;
8+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`SASS No Shims (doNotTrimOriginalFileExtension) styles.module.scss: files 1`] = `
4+
Array [
5+
"styles.module.scss.css",
6+
]
7+
`;
8+
9+
exports[`SASS No Shims (doNotTrimOriginalFileExtension) styles.module.scss: styles.module.scss.css 1`] = `
10+
"/**
11+
* Test SCSS module for verifying doNotTrimOriginalFileExtension output.
12+
* Expected output: styles.module.scss.css (not styles.module.css)
13+
*/
14+
.label {
15+
color: royalblue;
16+
}
17+
18+
.container {
19+
padding: 16px;
20+
}"
21+
`;
22+
23+
exports[`SASS No Shims (doNotTrimOriginalFileExtension) stylesGlobal.global.scss: files 1`] = `
24+
Array [
25+
"stylesGlobal.global.scss.css",
26+
]
27+
`;
28+
29+
exports[`SASS No Shims (doNotTrimOriginalFileExtension) stylesGlobal.global.scss: stylesGlobal.global.scss.css 1`] = `
30+
"/**
31+
* Test non-module SCSS for verifying doNotTrimOriginalFileExtension output.
32+
* Expected output: stylesGlobal.global.scss.css (not stylesGlobal.global.css)
33+
*/
34+
.globalWrapper {
35+
font-size: 16px;
36+
}"
37+
`;

0 commit comments

Comments
 (0)