HexliteralHexliteral is an ultimate build pipeline tool that transpiles any static assets into gzip-compressed C++ byte arrays ( OverviewIn device development with limited resources, embedding external static resources (web assets, images, fonts, certificate files, etc.) directly into C++ code is a common approach to bypass file system constraints. However, the process of maximizing memory efficiency by "gzipping" these assets and transpiling them into C++ compatible Hexliteral completely internalizes this cumbersome build flow within the VS Code environment. It provides end-to-end automation, reducing the time lag of switching between external tools and shell scripts to zero. FeaturesAvailable Commands
Two Conversion ApproachesHexliteral offers two powerful interfaces that can be flexibly used depending on your development scenario. 1. Quick Single-File Conversion (QuickPick / Context Menu)When you need to convert an individual file immediately, execute the command No prior configuration file is required. It works out-of-the-box with built-in safe default settings right after installation. 2. Advanced Batch Build Management via ManifestFor managing multiple resources, the batch build system (
Flexible & Robust Format Tuning with JSON SchemaThe data format and naming conventions of the generated binaries can be flexibly adapted to fit your project's coding standards and target environment constraints. Hexliteral does not pollute your VS Code environment settings ( Furthermore, Hexliteral is fully integrated with VS Code's JSON Schema. When editing Manifest Specification (
|
| Property | Type | Default | Description |
|---|---|---|---|
outputBoundary |
Number | 16 |
Number of hexadecimal bytes output per line in the generated array. |
cppDeclare |
Boolean | true |
Whether to wrap the array in a C++ variable declaration statement (e.g., const uint8_t name[] = { ... };). If false, only the raw contents (0x00, 0x01, ...) are output. |
emitSizeMacro |
Boolean | false |
Whether to auto-generate a macro indicating the compressed array size right before the array (e.g., #define name_len 123). |
indentSpaces |
Number | 2 |
Number of leading spaces (indentation) to insert at the beginning of each line of the hex array. |
headerComment |
Boolean | true |
Whether to output an auto-generated comment block indicating Hexliteral at the top of the file. |
2. Build Definitions (builds Array)
Defines the output destinations and the grouped resources included in them when executing a batch build. To generate multiple header files simultaneously, define multiple objects within this array.
Build Task Properties
| Property | Type | Required | Description |
|---|---|---|---|
out |
String | Yes | Relative path of the output C++ header file (e.g., "src/AutoConnectContentROData.h"). |
items |
Array | Yes | Array defining the files to be converted (details below). |
backup |
Boolean | No | If true, creates a backup with a ~ suffix before overwriting an existing destination file. |
guard |
String | No | Generates an include guard with the specified string (#ifndef GUARD_H ...). |
includes |
Array | No | Array of #include directives (e.g., ["\"AutoConnectContent.h\""]). |
using |
Array | No | Array of using namespace directives (e.g., ["AutoConnectContent"]). |
Asset Definitions (items Array)
Each object in the items array defines a single input file and how it should be handled in C++.
| Property | Type | Required | Description |
|---|---|---|---|
src |
String | Yes | Relative path of the source input file to convert. |
var |
String | Yes | Variable name (array name) defined in C++. Scope specifications like Namespace::VarName are supported. |
macro |
String | No | If specified, wraps this entire asset within a #if defined(MACRO_NAME) to #endif block for conditional compilation. |
emitSizeMacro |
Boolean | No | Overrides the global emitSizeMacro setting for this specific asset only. Useful when you need a size macro for only certain resources. |
Example (hexliteral.json)
{
"outputBoundary": 16,
"cppDeclare": true,
"emitSizeMacro": false,
"indentSpaces": 2,
"headerComment": true,
"builds": [
{
"out": "src/AutoConnectContentROData.h",
"backup": true,
"guard": "_AUTOCONNECTCONTENTRODATA_H_",
"includes": ["\"AutoConnectContent.h\""],
"items": [
{
"src": "extras/css/AutoConnectContentCSSBase.css",
"var": "Content::AutoConnectContentCSSBase"
},
{
"src": "extras/js/AutoConnectContentScriptOTA.js",
"var": "Content::AutoConnectContentScriptOTA",
"macro": "AUTOCONNECT_ENABLE_UPDATE",
"emitSizeMacro": true
}
]
}
]
}