@bem-transform/ts-computed-name
v1.0.0
Published
Compute name of block and elem for BEM components.
Maintainers
Readme
@bem-transform/ts-computed-name
Compute name of block and elem for BEM components.
Requirement
typescript >= 2.9.0Installation
npm i -D @bem-transform/ts-computed-nameConfiguration
This transform correctly work with ts-loader and awesome-typescript-loader.
const { computeClassBemName } = require('@bem-transform/ts-computed-name')Need add this transform into getCustomTransformers in before section.
{
test: /\.tsx?$/,
use: [
{
loader: require.resolve('awesome-typescript-loader'),
options: {
getCustomTransformers: () => ({
before: [
computeClassBemName(options),
],
}),
},
},
},Options
| Property | Type | Default | Description |
| -------- | ---- | ------- | ----------- |
| availableClassParent | string[] | ['Block', 'Elem'] | Will add properties only to classes who have the parents from list. |
| availibleBemName | boolean | true | Will add the properties of block and elem based on the location in the fs. |
| availibleDisplayName | boolean | true | Will add the static property of displayName based on the location in the fs. (Recommended add only in development mode for debugging) |
| naming | string | 'origin' | naming convention that uses at the project, should be origin or react. |
| overrideExistingProperties | boolean | true | Overrides existing properties block, elem and displayName. |
