Skip to content

Commit db84c5d

Browse files
committed
Fix a regression
1 parent 8c66cf2 commit db84c5d

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

run.hxml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
--js bin/php_minifier.js
2+
--macro php_minifier.Macro.shebang("node")
23
--main php_minifier.Program
34
share/build.hxml

src/php_minifier/Macro.hx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package php_minifier;
2+
3+
#if macro
4+
import haxe.macro.Compiler;
5+
import haxe.macro.Context;
6+
import sys.io.File;
7+
8+
/** Provides initialization macros. **/
9+
@:noDoc abstract class Macro {
10+
11+
/** Adds a shebang to the compiled file. **/
12+
public static function shebang(executable: String) Context.onAfterGenerate(() -> {
13+
final path = Compiler.getOutput();
14+
File.saveContent(path, '#!/usr/bin/env $executable\n${File.getContent(path)}');
15+
});
16+
}
17+
#end

0 commit comments

Comments
 (0)