You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -116,15 +31,13 @@ npm i -D posthtml-minify-classnames
116
31
117
32
## Usage
118
33
119
-
Note: To use with external sheets, other plugins must be used, like [posthtml-inline-assets](https://github.com/jonathantneal/posthtml-inline-assets) and [posthtml-style-to-file](https://github.com/posthtml/posthtml-style-to-file), or other build task plugins.
120
-
121
34
```js
122
-
var posthtml =require('posthtml');
123
-
var minifyClassnames =require('posthtml-minify-classnames');
console.log(result.html); //=> '<style>#a { color: red } .bar { color: blue }</style><div id="a" class="bar">baz</div>'
140
53
});
141
54
```
55
+
> Note: To use with external sheets, other plugins must be used, like [posthtml-inline-assets](https://github.com/jonathantneal/posthtml-inline-assets) and [posthtml-style-to-file](https://github.com/posthtml/posthtml-style-to-file), or other build task plugins.
142
56
143
57
## Options
144
58
145
-
### filter
146
-
147
-
Type: regex, Default: `/^.js-/`
59
+
#### `filter`
148
60
149
-
### genNameClass & genNameId
61
+
Type: `RegExp`
62
+
Default: `/^.js-/`
63
+
Description: *Regular expression that excludes names from processing*
150
64
151
-
Type: string, Default: `'genName'`
65
+
#### `genNameClass` & `genNameId`
152
66
153
-
Available options: `'genName'`, `'genNameEmoji'`, `'genNameEmojiString'`, `false`
-`'genName'` Generates the smallest possible names
156
71
-`'genNameEmoji'` Generates small emoji based names
157
72
-`'genNameEmojiString'` Generates random emoji with 3 emojis in each
158
73
-`false` Preserves names. Use this to ignore ids or classes
159
74
160
-
**Note:** While emoji visually looks like a great way to reduce the size of input values, they often use 3-4 bytes or more (some can be over 20 bytes for a single rendered glyph). The below example 3 emoji string values range between 10-12 bytes in size, that's equivalent to ASCII strings up to 12 characters long. Meanwhile base36(`0-9,a-z`) provides an "alphabet" of 36 characters and an equivalent length of 3 characters is more than enough for most users (`36^3 = 46656`).
161
-
162
-
Example:
163
-
164
-
```html
165
-
<html>
166
-
<style>
167
-
#🚧🕥🏉 {
168
-
text-transform: uppercase;
169
-
}
170
-
.☘👙📙 {
171
-
color: blue;
172
-
}
173
-
.⏲📂⚗ {
174
-
background: white;
175
-
}
176
-
.js-overlay {
177
-
display: none;
178
-
}
179
-
#js-button {
180
-
color: blue;
181
-
}
182
-
@media (min-width: 768px) {
183
-
.☘👙📙 {
184
-
color: gray;
185
-
}
186
-
}
187
-
</style>
188
-
<body>
189
-
<svgstyle="display:none">
190
-
<symbolid="👂🗨🌹"><pathd=""></path></symbol>
191
-
</svg>
192
-
<h1id="🚧🕥🏉">Title</h1>
193
-
<pclass="☘👙📙">OMG</p>
194
-
<divclass="js-overlay"></div>
195
-
<divid="js-button"></div>
196
-
<divclass="⏲📂⚗">
197
-
card content
198
-
</div>
199
-
<svg>
200
-
<usehref="#👂🗨🌹"></use>
201
-
</svg>
202
-
<labelfor="🏻🔐🙍">Click me</label>
203
-
<inputtype="text"id="🏻🔐🙍">
204
-
</body>
205
-
</html>
206
-
```
75
+
> **Note:** While emoji visually looks like a great way to reduce the size of input values, they often use 3-4 bytes or more (some can be over 20 bytes for a single rendered glyph). The below example 3 emoji string values range between 10-12 bytes in size, that's equivalent to ASCII strings up to 12 characters long. Meanwhile base36(`0-9,a-z`) provides an "alphabet" of 36 characters and an equivalent length of 3 characters is more than enough for most users (`36^3 = 46656`).
207
76
208
-
Future: Option to define own generator function.
77
+
## TODO
209
78
210
-
### Contributing
79
+
- Option to define own generator function.
211
80
212
-
See [PostHTML Guidelines](https://github.com/posthtml/posthtml/tree/master/docs) and [contribution guide](CONTRIBUTING.md).
0 commit comments