minify-selectors
Advanced tools
Comparing version 2.4.1 to 2.6.0
{ | ||
"name": "minify-selectors", | ||
"version": "2.4.1", | ||
"version": "2.6.0", | ||
"description": "Post-processor that minifies classes and IDs in CSS, HTML, Javascript and SVG files.", | ||
@@ -5,0 +5,0 @@ "author": { |
191
README.md
@@ -270,4 +270,5 @@ [1]: https://github.com/adamgian/minify-selectors/releases/latest | ||
## Configuration | ||
## Command line options | ||
### Command line options | ||
@@ -284,3 +285,3 @@ <table> | ||
<td valign="top"> | ||
<code lang="shell">--input</code> (or <code lang="shell">-i</code>) | ||
<code lang="shell">--input</code>, <code lang="shell">-i</code> | ||
</td> | ||
@@ -293,3 +294,3 @@ <td> | ||
<td valign="top"> | ||
<code lang="shell">--output</code> (or <code lang="shell">-o</code>) | ||
<code lang="shell">--output</code>, <code lang="shell">-o</code> | ||
</td> | ||
@@ -302,6 +303,14 @@ <td> | ||
<td valign="top"> | ||
<code lang="shell">--config</code>, <code lang="shell">-c</code> | ||
</td> | ||
<td> | ||
Alternatively instead of using CLI arguments, an external JSON config file can be provided instead. See section below: '<a href="#external-json-config-options">External JSON config options</a>' for more information. | ||
</td> | ||
</tr> | ||
<tr> | ||
<td valign="top"> | ||
<code lang="shell">--alphabet</code> | ||
</td> | ||
<td> | ||
<sup>Optional</sup><br> | ||
<sup><i>Optional</i></sup><br> | ||
String sequence of characters to use when encoding. | ||
@@ -316,3 +325,3 @@ <br><br>Default: <code>"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"</code> | ||
<td> | ||
<sup>Optional</sup><br> | ||
<sup><i>Optional</i></sup><br> | ||
Index to start incrementing and encoding from. | ||
@@ -327,3 +336,3 @@ <br><br>Default: <code>0</code> | ||
<td> | ||
<sup>Optional</sup><br> | ||
<sup><i>Optional</i></sup><br> | ||
Enable concurrent processing. | ||
@@ -338,4 +347,4 @@ <br><br>Default: <code>false</code> | ||
<td> | ||
<sup>Optional</sup><br> | ||
Reorder selectors by frequency before minifying. | ||
<sup><i>Optional</i></sup><br> | ||
Reorder selectors by descending frequency before assigning indexes and minifying. | ||
<br><br>Default: <code>true</code> | ||
@@ -346,7 +355,8 @@ </td> | ||
<td valign="top"> | ||
<code lang="shell">--custom-class-attribute</code> | ||
<code lang="shell">--custom-id-attribute</code> | ||
</td> | ||
<td> | ||
<sup>Optional</sup><br> | ||
Custom HTML and SVG attributes that contain a space-separated list of classes. | ||
<sup><i>Optional</i></sup><br> | ||
Custom HTML and SVG attributes that contain an ID (or space-separated list of IDs). For example, in Bootstrap you may have <code lang="html">data-bs-target="#exampleModal"</code> and <code lang=html>data-bs-parent="#accordionExample"</code> | ||
<br><br>Usage: <code lang="shell">--custom-id-attribute data-bs-target data-bs-parent</code> | ||
</td> | ||
@@ -356,7 +366,7 @@ </tr> | ||
<td valign="top"> | ||
<code lang="shell">--custom-id-attribute</code> | ||
<code lang="shell">--custom-class-attribute</code> | ||
</td> | ||
<td> | ||
<sup>Optional</sup><br> | ||
Custom HTML and SVG attributes that contain an ID (or space-separated list of IDs). | ||
<sup><i>Optional</i></sup><br> | ||
Custom HTML and SVG attributes that contain a space-separated list of classes. | ||
</td> | ||
@@ -369,3 +379,3 @@ </tr> | ||
<td> | ||
<sup>Optional</sup><br> | ||
<sup><i>Optional</i></sup><br> | ||
Custom HTML and SVG attributes that contain a selector string. | ||
@@ -379,3 +389,3 @@ </td> | ||
<td> | ||
<sup>Optional</sup><br> | ||
<sup><i>Optional</i></sup><br> | ||
Custom HTML and SVG attributes that contain a URL. | ||
@@ -389,3 +399,3 @@ </td> | ||
<td> | ||
<sup>Optional</sup><br> | ||
<sup><i>Optional</i></sup><br> | ||
Custom HTML and SVG attributes that contain CSS styles. | ||
@@ -399,3 +409,3 @@ </td> | ||
<td> | ||
<sup>Optional</sup><br> | ||
<sup><i>Optional</i></sup><br> | ||
Custom HTML and SVG attributes that contain JS code. | ||
@@ -406,1 +416,146 @@ </td> | ||
</table> | ||
### External JSON config options | ||
An example config file: | ||
```json | ||
{ | ||
"input": "/User/Adam/Github/project/dist", | ||
"output": "/User/Adam/Github/project/dist", | ||
"parallel": true, | ||
"customAttributes": { | ||
"id": [ | ||
"data-bs-target", | ||
"data-bs-parent" | ||
] | ||
} | ||
} | ||
``` | ||
<table> | ||
<thead> | ||
<tr> | ||
<th align="left" width="180">Option</th> | ||
<th align="left">Description</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td valign="top"> | ||
<code lang="shell">input</code> | ||
</td> | ||
<td> | ||
Directory to process. Any CSS, HTML, JS and SVG files in the given directory and sub-directories will be parsed. | ||
</td> | ||
</tr> | ||
<tr> | ||
<td valign="top"> | ||
<code lang="shell">output</code> | ||
</td> | ||
<td> | ||
Directory to place processed files into. Setting the output path to be the same as the input path will overwrite existing files. | ||
</td> | ||
</tr> | ||
<tr> | ||
<td valign="top"> | ||
<code lang="shell">alphabet</code> | ||
</td> | ||
<td> | ||
<sup><i>Optional</i></sup><br> | ||
String sequence of characters to use when encoding. | ||
<br><br>Default: <code>"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"</code> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td valign="top"> | ||
<code lang="shell">start-index</code> | ||
</td> | ||
<td> | ||
<sup><i>Optional</i></sup><br> | ||
Index to start incrementing and encoding from. | ||
<br><br>Default: <code>0</code> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td valign="top"> | ||
<code lang="shell">parallel</code> | ||
</td> | ||
<td> | ||
<sup><i>Optional</i></sup><br> | ||
Enable concurrent processing. | ||
<br><br>Default: <code>false</code> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td valign="top"> | ||
<code lang="shell">sort</code> | ||
</td> | ||
<td> | ||
<sup><i>Optional</i></sup><br> | ||
Reorder selectors by descending frequency before assigning indexes and minifying. | ||
<br><br>Default: <code>true</code> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td valign="top"> | ||
<code lang="shell">customAttributes.id</code> | ||
</td> | ||
<td> | ||
<sup><i>Optional</i></sup><br> | ||
Custom HTML and SVG attributes that contain an ID (or space-separated list of IDs). | ||
<br><br>Usage: <code lang="shell">"id": [ "foo", ..., "baz" ]</code> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td valign="top"> | ||
<code lang="shell">customAttributes.class</code> | ||
</td> | ||
<td> | ||
<sup><i>Optional</i></sup><br> | ||
Custom HTML and SVG attributes that contain a space-separated list of classes. | ||
<br><br>Usage: <code lang="shell">"class": [ "foo", ..., "baz" ]</code> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td valign="top"> | ||
<code lang="shell">customAttributes.selector</code> | ||
</td> | ||
<td> | ||
<sup><i>Optional</i></sup><br> | ||
Custom HTML and SVG attributes that contain a selector string. | ||
<br><br>Usage: <code lang="shell">"selector": [ "foo", ..., "baz" ]</code> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td valign="top"> | ||
<code lang="shell">customAttributes.anchor</code> | ||
</td> | ||
<td> | ||
<sup><i>Optional</i></sup><br> | ||
Custom HTML and SVG attributes that contain a URL. | ||
<br><br>Usage: <code lang="shell">"anchor": [ "foo", ..., "baz" ]</code> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td valign="top"> | ||
<code lang="shell">customAttributes.style</code> | ||
</td> | ||
<td> | ||
<sup><i>Optional</i></sup><br> | ||
Custom HTML and SVG attributes that contain CSS styles. | ||
<br><br>Usage: <code lang="shell">"style": [ "foo", ..., "baz" ]</code> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td valign="top"> | ||
<code lang="shell">customAttributes.script</code> | ||
</td> | ||
<td> | ||
<sup><i>Optional</i></sup><br> | ||
Custom HTML and SVG attributes that contain JS code. | ||
<br><br>Usage: <code lang="shell">"script": [ "foo", ..., "baz" ]</code> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> |
28021
548