Skip to content

Commit

Permalink
Add bem-tools-create and template for tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
vithar committed May 26, 2019
1 parent 034e814 commit ad98a1c
Show file tree
Hide file tree
Showing 4 changed files with 586 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .bem/templates/tsx.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = function ({ block, elem, mod = {} }) {
return `import React, { useContext } from 'react'
import { cn } from '@bem-react/classname'
import { Context } from '../Context/Context'
const cls = cn('${block}');
export function ${block}({ className }) {
const page = useContext(Context);
return (
<div className={cls(null, [className])}>
</div>
)
}`;
};
23 changes: 23 additions & 0 deletions .bemrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
root: true,
levels: {
'src/components': {}
},
modules: {
'bem-tools': {
plugins: {
create: {
templates: {
tsx: '.bem/templates/tsx.js'
},
techs: ['css', 'tsx'],
levels: {
'src/components': {
default: true
}
}
}
}
}
}
}
Loading

0 comments on commit ad98a1c

Please sign in to comment.