feat(workflow): example stats page with embedded Chart.js, inline form validation errors
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
// Build-time helper: embeds example/assets into generated C++ using the
|
||||
// MoloApp embedder (src/cli/embed). Same engine as `molo embed`, without the
|
||||
// CLI's database and TLS link dependencies.
|
||||
// Usage: embed_assets <asset-dir> <out.cpp> <out.hpp> <namespace>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "embed/asset_scanner.hpp"
|
||||
#include "embed/embed_emitter.hpp"
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
if (argc != 5) {
|
||||
std::cerr << "usage: embed_assets <dir> <out.cpp> <out.hpp> <namespace>\n";
|
||||
return 2;
|
||||
}
|
||||
molo::embed::AssetScanner scanner;
|
||||
molo::embed::ScanResult scanned = scanner.scan(argv[1]);
|
||||
if (!scanned.ok()) {
|
||||
std::cerr << scanned.error << "\n";
|
||||
return 1;
|
||||
}
|
||||
molo::embed::EmitOptions opts;
|
||||
opts.namespc = argv[4];
|
||||
molo::embed::EmbedEmitter emitter;
|
||||
std::string error;
|
||||
if (!emitter.emit(scanned.files, argv[2], argv[3], opts, error)) {
|
||||
std::cerr << error << "\n";
|
||||
return 1;
|
||||
}
|
||||
std::cout << "embedded " << scanned.files.size() << " files ("
|
||||
<< scanned.total_bytes << " bytes)\n";
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user