dotfiles/plugins/tampermonkey-mzte/src/Macro.hx

18 lines
468 B
Haxe
Raw Normal View History

2023-08-19 16:03:22 +02:00
#if macro
import haxe.macro.Compiler;
import haxe.macro.Context;
import sys.io.File;
#end
macro function init() {
var oldHeader = Context.definedValue("source-header");
var header = Std.string(File.read("assets/header.txt").readAll());
Compiler.define("source-header", '$header\n//$oldHeader');
return macro {};
}
macro function fileContent(path:String):haxe.macro.Expr.ExprOf<String> {
return macro $v{Std.string(File.read(path).readAll())};
}