Skip to content

Commit 7bba814

Browse files
committed
expose source css to generateScopedName
1 parent c04857f commit 7bba814

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const processor = postcss.plugin('postcss-modules-scope', function(options) {
3535
let exports = {};
3636

3737
function exportScopedName(name) {
38-
let scopedName = generateScopedName(name, css.source.input.from);
38+
let scopedName = generateScopedName(name, css.source.input.from, css.source.input.css);
3939
exports[name] = exports[name] || [];
4040
if(exports[name].indexOf(scopedName) < 0) {
4141
exports[name].push(scopedName);
@@ -156,7 +156,7 @@ const processor = postcss.plugin('postcss-modules-scope', function(options) {
156156
};
157157
});
158158

159-
processor.generateScopedName = function(exportedName, path) {
159+
processor.generateScopedName = function(exportedName, path, css) {
160160
let sanitisedPath = path.replace(/\.[^\.\/\\]+$/, '').replace(/[\W_]+/g, '_').replace(/^_|_$/g, '');
161161
return `_${sanitisedPath}__${exportedName}`;
162162
};

0 commit comments

Comments
 (0)