Skip to content

Commit 0b12d6d

Browse files
authored
Merge pull request #9 from GitScrum/master
[fix]: break if classes are not trimmed
2 parents e51e68f + a947eaa commit 0b12d6d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/cssModules.es6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function getCssClassName(cssModulesPath, cssModuleName) {
3636

3737
const cssModules = getCssModules(path.resolve(cssModulesPath));
3838

39-
return cssModuleName.split(' ')
39+
return cssModuleName.trim().split(' ')
4040
.map(cssModuleName => {
4141
const cssClassName = _get(cssModules, cssModuleName);
4242
if (! cssClassName) {

test/cssModules.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ describe('posthtml-css-modules', () => {
3333
);
3434
});
3535

36+
it('should do not broken if classes not trimmed', () => {
37+
return init(
38+
'<div class="foob" css-module="title color "></div>',
39+
'<div class="foob __title __heading __color"></div>',
40+
classesPath
41+
);
42+
});
43+
3644

3745
it('should inline CSS module from the directory', () => {
3846
return init(

0 commit comments

Comments
 (0)