Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
How @bem/sdk.naming.presets works?
node v10.24.1
version:
1.0.0
endpoint
share
tweet
Create a custom preset. All specified options are overwritten in the following order: default preset <-- userDefaults <-- options
// Use this options as default. const userDefaults = { fs: { delims: { elem: '__', mod: '_' }, scheme: 'flat' } } // Options to create preset with. const options = { preset: 'legacy', // Redefine default preset. If not specified 'origin' preset will be used as default. delims: { mod: { val: '='} }, fs: { delims: { mod: { val: '='} } } } const customPreset = require('@bem/sdk.naming.presets/create')(options, userDefaults);
Stringify a BEM entity name with created preset.
const stringify = require('@bem/sdk.naming.entity.stringify')(customPreset); stringify({ block: 'my-block', elem: 'my-element', mod: { name: 'my-modifier', val: 'some-value'}});
Parse a BEM entity name to check created preset.
const parse = require('@bem/sdk.naming.entity.parse')(customPreset); parse('my-block_my-modifier=some-value');
Loading…
no comments
sign in
to comment