Skip to content

Commit

Permalink
Merge pull request #18 from soxhub/scoped-class-multiple
Browse files Browse the repository at this point in the history
scoped-class helper with multiple classes
  • Loading branch information
candunaj authored Apr 11, 2023
2 parents fc6a6d2 + bb4d3fe commit 2a504e9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion ember-scoped-css/src/renameClass.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const getPostfix = require('./getPostfix');

module.exports = function (className, projectCssPath) {
return className + '_' + getPostfix(projectCssPath);
const classes = className.split(/\s+/);
const postfix = getPostfix(projectCssPath);
return classes.map((c) => c + '_' + postfix).join(' ');
};

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test-apps/v2-addon/src/components/footer.gjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class='alert' data-test3={{concat "test" (scoped-class 'my-class')}} data-test2={{scoped-class 'my-class'}} data-test={{(scoped-class 'my-class')}}>
<div class='alert' data-test3={{concat "test" (scoped-class 'my-class my-other-class')}} data-test2={{scoped-class 'my-class'}} data-test={{(scoped-class 'my-class')}}>
<div>
{{@title}}
</div>
Expand Down

0 comments on commit 2a504e9

Please sign in to comment.