Skip to content

Commit 0482bd5

Browse files
committed
fix sass tilde importer partials support
1 parent 56514cc commit 0482bd5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/importers/sassTildeImporter.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,13 @@ export const sassTildeImporter: sass.FileImporter<'sync'> = {
4141
// Support sass partials by including paths where the file is prefixed by an underscore.
4242
const basename = path.basename(nodeModSubpath);
4343
if (!basename.startsWith('_')) {
44-
const partials = subpathsWithExts.map((file) =>
45-
file.replace(basename, `_${basename}`),
46-
);
44+
const partials = subpathsWithExts.map((file) => {
45+
const parts = path.parse(file);
46+
const replacement = '_'.concat(parts.name);
47+
parts.base = parts.base.replace(parts.name, replacement);
48+
parts.name = replacement;
49+
return path.format(parts);
50+
});
4751
subpathsWithExts.push(...partials);
4852
}
4953

0 commit comments

Comments
 (0)