Comparing version 2.0.0 to 2.1.0
# Bemto changelog | ||
## v2.1.0 (2016-12-26) | ||
- Added support for prefix objects. | ||
- Added settings for delimiters between classes. | ||
- Fixed escaping for inline tags' attribute values, #84. | ||
## v2.0.0 (2016-12-18) | ||
@@ -4,0 +10,0 @@ |
{ | ||
"name": "bemto.pug", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"main": "./lib/index.pug", | ||
@@ -5,0 +5,0 @@ "author": "Roman Komarov <kizu@kizu.ru>", |
@@ -21,2 +21,3 @@ # Bemto — mixins for writing [BEM][]-style code for [Pug][] [![Build Status][build]][build-link] [![NPM version][version]][version-link] | ||
- [Context](#context) | ||
- [Redefining tag's metadata](#redefining-tags-metadata) | ||
@@ -27,3 +28,7 @@ 3. [Settings](#settings) | ||
- [Setting for Modifier syntax](#setting-for-modifier-syntax) | ||
- [Setting for allowing nested elements](#setting-for-allowing-nested-elements) | ||
- [Scope for the settings](#scope-for-the-settings) | ||
- [Setting for the output syntax of the elements/modifiers](#setting-for-allowing-nested-elements) | ||
4. [Using for building complex mixins](#using-for-building-complex-mixins) | ||
@@ -292,4 +297,8 @@ | ||
If you'd like to prefix all your bemto-generated blocks, you can set the `prefix` setting to something, so it would be added to the beginning of all your blocks. Like this: | ||
If you'd like to prefix all your bemto-generated blocks, you can set the `prefix` setting to a String or an Object. | ||
#### Strings for prefix setting | ||
If you'd set a string, it would be just prepended to the names of all blocks: | ||
```Pug | ||
@@ -313,2 +322,32 @@ - set_bemto_settings({ prefix: 'b-' }) | ||
Note that if you had already used this prefix in a classname, it won't be added, so you won't have occasional duplicated prefixes. | ||
#### Objects for prefix setting | ||
If you'd want to have more control over prefixes, you can use a special object instead of a string: | ||
``` Pug | ||
- | ||
set_bemto_settings({ | ||
prefix: { | ||
'': 'b-', | ||
'js-': true, | ||
'is-': 'is-', | ||
'global-': '', | ||
'nope-': false, | ||
'sc-': 'shortcut-' | ||
} | ||
}) | ||
``` | ||
Look at the above example, it have all the variations the prefix object accepts: | ||
- The empty string for key works the same as a string setting: you'd get the value for this key prepended for all classnames without detected prefixes. | ||
- If a value for any key is `true`, this prefix would be always treated as such and won't be prepended by other prefixes. | ||
- If a value for a key is `false` or an empty string, the classnames with this prefix would be rendered without it. | ||
- In other cases, where the key and the value are both strings, all the key prefixes in the source code would be replaced with the value ones, and also all of those prefixes would be treated as registered ones, so you wouldn't add other prefixes for them. | ||
### Setting for Element syntax | ||
@@ -448,2 +487,21 @@ | ||
### Setting for delimiters between classnames | ||
If you'd like to have extra delimieters between the rendered classnames for clarity, you can use a `class_delimiter` setting: | ||
``` Pug | ||
- set_bemto_settings({ class_delimiter: '|' }) | ||
+b.foo.bar_baz | ||
``` | ||
Would be rendered as | ||
``` HTML | ||
<div class="foo | bar | bar_baz"> | ||
</div> | ||
``` | ||
Note that there would be always added spaces around the given delimiter, so you don't need to include them in the setting's value. | ||
## Using for building complex mixins | ||
@@ -450,0 +508,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49012
562