1. Important note
  2. Minification
    1. Whitespace
    2. Numbers
    3. Colors
    4. Selectors, custom properties, animation names
    5. Empty rules
  3. Executable arguments
    1. Show help
    2. Show current configuration
    3. Create configuration file
    4. Set the configuration file path
    5. Standard output
    6. Set input file
    7. Set output directory
  4. Configuration file
    1. Header [general]
      1. List settings
      2. String settings
      3. Boolean settings
    2. Header [css]
      1. List settings
      2. Boolean settings
  5. PHP include file
  6. Minification "on the fly"
IMPORTANT NOTE:

If some functionality doesn't work properly for you, disable it within the configuration file
and report a bug.

Be careful of using attribute selectors on id and class attributes, when using id and class minification.

HSPP should work correctly with UTF-8 encoding and encodings, which are a subset of it.
Also 8-bit encodings such as ISO 8859-x and windows-125x should not cause problems.

HSPP currently does not support source mapping.

Minification

Whitespace

All optional whitespace characters will be removed.

Numbers

Leading and trailing zeros will be removed.
Examples:
000.500.5
001.0001
Scientifical notation will be used where possible (only if the number will get shorter).
Examples:
1000001e5
1230000123e4
1010 (not 1e1!)
100100 (not 1e2!)

Colors

Hex colors will be shortened where possible
Examples:
#aabbcc#abc
#aabbccdd#abcd
rgb() and rgba() functions will be rewritten as hex color.
Examples:
In case alpha channel is not set or is set to 100%, each of
rgb(51, 102, 153)
rgb(20%, 40%, 60%)
rgb(51, 102, 153, 1)
rgb(20%, 40%, 60%, 1)
rgb(51, 102, 153, 100%)
rgb(20%, 40%, 60%, 100%)
rgb(51 102 153)
rgb(20% 40% 60%)
rgb(51 102 153 / 1)
rgb(20% 40% 60% / 1)
rgb(51 102 153 / 100%)
rgb(20% 40% 60% / 100%)
will result in #369.
In case use_rgba_hex_notation is disabled and alpha is < 100%, each of
rgb(51, 102, 153, 0.5)
rgb(20%, 40%, 60%, 0.5)
rgb(51, 102, 153, 50%)
rgb(20%, 40%, 60%, 50%)
will result in rgb(51,102,153,.5)
and each of
rgb(51 102 153 / 0.5)
rgb(20% 40% 60% / 0.5)
rgb(51 102 153 / 50%)
rgb(20% 40% 60% / 50%)
in rgb(51 102 153/.5).
In case use_rgba_hex_notation is enabled and alpha is < 100%, each of
rgb(51, 102, 153, 0.5)
rgb(20%, 40%, 60%, 0.5)
rgb(51, 102, 153, 50%)
rgb(20%, 40%, 60%, 50%)
rgb(51 102 153 / 0.5)
rgb(20% 40% 60% / 0.5)
rgb(51 102 153 / 50%)
rgb(20% 40% 60% / 50%)
will result in #3366997f.
The minification behavior for the rgb() and rgba() functions is the same.

Selectors, custom properties, animation names

Id and class selectors, custom properties and animation names will be minified, if the corresponding settings are enabled (minify_ids, minify_class_names, minify_custom_properties, minify_animation_names).
Attribute selector values will get unquoted where possible.
Keyframes selectors will be minified.
Examples:
#some-id {...}#a{...}
.some-class {...}.a{...}
--some-color: #abc--a:#abc
color: var(--some-color)color:var(--a)
@keyframes fade-in {...}@keyframes a{...}
animation-name: fade-inanimation-name:a
input[type="text"] {...}input[type=text]{...}
from {...}0%{...}
100% {...}to{...}
The names created by the name generator consist of lowercase/uppercase letters and digits where the first character is always a letter.

Empty rules

If remove_empty_rules is enabled, empty rules will be removed.
Empty rule example:
.some-class > img { }

Executable arguments

Configuration file

Initially there is no configuration file provided with the executable. If there is no configuration file within the directory where the executable is located, HSPP will use default configuration.
To show current configuration, use argument --config-info.
To create a configuration file with default settings, pass --create-config-file argument to the executable. The configuration file will be created into directory in which the executable file of HSPP is located.
Also use this option to reset the configuration file to defaults, if it already exists.
If the configuration file already exists, HSPP will ask you to confirm the overwriting of the existing file.
The configuration file is subdivided into sections, which contain configurable options. Each section begins with a header. Options following each header belong to this header. For example all options which follow the header [general] belong to this header, until the next header or the end of file is reached.

Comments

# starts a comment, which ends at the end of line.

Comments are skipped when reading the configuration file (i.e. not evaluated as configuration data). Comments can be used to describe the configuration. But they are also useful, if you want to temporarily disable or switch to another data for an option but keep the data for later use.
The comment character can be used on any position in the configuration file. Consequently any file/directory paths may not contain this character, because the path string will not be read completely. This behavior might change in future versions of HSPP by using quoted strings.

Header [general]

List settings
Accepted values: File extensions separated by space (including leading dot)

String settings

This paths will be used, if no paths are passed through the command line. Corresponding command line options -i and -o, when used, will override path settings of the configuration file.
The last four settings are only significant if create_php_include_file is enabled.

Boolean settings

Accepted values: on / off

Header [css]

List settings

Accepted values: Terms separated by space

Boolean settings

Accepted values: on / off

PHP include file

If the setting create_php_include_file and at least one of minify_ids, minify_class_names, minify_custom_properties, minify_animation_names are enabled, a PHP include file will be created within the output directory.
Example of PHP include file content:
${php_class_array_name} = array( '[initial-name]' => '[replacement-name]', 'some-class-1' => 'a', 'some-class-2' => 'b', 'some-class-3' => 'c', ... );
Including PHP include file:
include 'hspp.php';
Using name arrays inside including file:
<body class="<?=${php_class_array_name}['initial-name'];?>">
while (...) { echo '<div class="'.${php_class_array_name}['initial-name'].'">...</div>'; }

Minification "on the fly"

If you have root access to your server, you can let HSPP minify your stylesheets "on the fly".
With PHP this can be achieved using execution operator (backticks) and exec() or shell_exec() functions.
Example of using execution operator on unixoid system:
echo `./hspp -i/path/to/some/file.css --stdo`;
Last updated: March 4th, 2023
Data Protection Declaration
© 2019-2020
Waldemar Zimpel