Skip to content

Commit 0fdf467

Browse files
committed
✨ Add should_add_exports() SCSS function
1 parent a7e923d commit 0fdf467

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Make `AQL` trail placeholders default to explicit `null` values
44
* Add the abstract `Meta` field class: these should be used for fields that are not directly stored in the database
55
* Add association aliases as a meta field to model schemas
6+
* Add `should_add_exports()` SCSS function
67

78
## 1.4.0-alpha.3 (2024-02-25)
89

lib/core/middleware.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ if (alchemy.settings.frontend.stylesheet.enable_scss) {
8383
}
8484

8585
return result;
86-
}
86+
},
87+
'should_add_exports()': function() {
88+
return sass.types.Boolean.FALSE;
89+
},
8790
};
8891
}
8992

@@ -1278,9 +1281,20 @@ Alchemy.setMethod(function getCompiledSassPath(sassPath, options, callback) {
12781281
return writeToTemp(source);
12791282
}
12801283

1284+
let custom_functions = sass_functions;
1285+
1286+
if (options.add_exports) {
1287+
custom_functions = {
1288+
...custom_functions,
1289+
'should_add_exports()': function() {
1290+
return sass.types.Boolean.TRUE;
1291+
},
1292+
};
1293+
}
1294+
12811295
const render_options = {
12821296
includePaths : styleDirs.getSorted(),
1283-
functions : sass_functions,
1297+
functions : custom_functions,
12841298
importer : customScssImporter,
12851299
logger : {
12861300
warn : logSassWarning,
@@ -1469,7 +1483,11 @@ function extractPostCSSExports(postcss_result) {
14691483
*/
14701484
Alchemy.setMethod(async function extractCSSExports(css_path) {
14711485

1472-
let result = await findStylesheet(css_path, {post_css_only: true, compile: true});
1486+
let result = await findStylesheet(css_path, {
1487+
post_css_only: true,
1488+
add_exports: true,
1489+
compile: true
1490+
});
14731491

14741492
result = extractPostCSSExports(result);
14751493

0 commit comments

Comments
 (0)