@@ -21,18 +21,19 @@ std::string readFile(const std::filesystem::path& path)
21
21
22
22
int main (int argc, char ** argv)
23
23
{
24
- if (argc != 5 )
24
+ if (argc != 6 )
25
25
{
26
- std::cout
27
- << " Expected 4 argument: <index.html> <import_scripts> <import_styles> <import_scripts_defer >, but got "
28
- << argc - 1 << " \n " ;
26
+ std::cout << " Expected 4 argument: <index.html> <import_scripts> <import_styles> <import_scripts_defer> "
27
+ " <lean_html >, but got "
28
+ << argc - 1 << " \n " ;
29
29
return 1 ;
30
30
}
31
31
32
32
const auto index = std::filesystem::path{argv[1 ]};
33
33
const auto importScripts = std::filesystem::path{argv[2 ]};
34
34
const auto importStyles = std::filesystem::path{argv[3 ]};
35
35
const auto importScriptsDefer = std::string{argv[4 ]} == " defer" ? true : false ;
36
+ const auto leanHtml = std::string{argv[5 ]} == " lean" ? true : false ;
36
37
37
38
std::string indexHtml;
38
39
try
@@ -57,8 +58,17 @@ int main(int argc, char** argv)
57
58
relativeImportScriptsFile.generic_string () + " \" ;\n\t </script>\n " ;
58
59
const std::string importStylesHtml =
59
60
" \t <style>\n\t\t @import \" " + relativeImportStylesFile.generic_string () + " \" ;\n\t </style>\n " ;
60
- const std::string importBinIndexHtml =
61
- " \t <script type=\" module\" defer>\n\t\t import \" " + binIndex.generic_string () + " \" ;\n\t </script>\n " ;
61
+
62
+ std::string importBinIndexHtml;
63
+ if (!leanHtml)
64
+ {
65
+ importBinIndexHtml =
66
+ " \t <script type=\" module\" defer>\n\t\t import \" " + binIndex.generic_string () + " \" ;\n\t </script>\n " ;
67
+ }
68
+ else
69
+ {
70
+ importBinIndexHtml = " \t <script type=\" module\" defer src=\" " + binIndex.generic_string () + " \" ></script>\n " ;
71
+ }
62
72
63
73
// find end of header </head> from behind in indexHtml:
64
74
auto headEnd = indexHtml.rfind (" </head>" );
0 commit comments